Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
b013f9f2
Commit
b013f9f2
authored
Sep 18, 2019
by
Steven Murray
Browse files
Improved the exception handling within the main() function of cta-rdbmsUnitTests
parent
383fed11
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/rdbmsUnitTests.cpp
View file @
b013f9f2
...
@@ -54,31 +54,42 @@ static RdbmsUnitTestsCmdLineArgs parseCmdLine(const int argc, char ** argv) {
...
@@ -54,31 +54,42 @@ static RdbmsUnitTestsCmdLineArgs parseCmdLine(const int argc, char ** argv) {
}
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
// The following line must be executed to initialize Google Mock
try
{
// (and Google Test) before running the tests.
// The following line must be executed to initialize Google Mock
::
testing
::
InitGoogleMock
(
&
argc
,
argv
);
// (and Google Test) before running the tests.
::
testing
::
InitGoogleMock
(
&
argc
,
argv
);
// Google test will consume its options from the command-line and leave everything else
// Google test will consume its options from the command-line and leave everything else
g_cmdLineArgs
=
parseCmdLine
(
argc
,
argv
);
g_cmdLineArgs
=
parseCmdLine
(
argc
,
argv
);
cta
::
log
::
DummyLogger
dummyLogger
(
"dummy"
,
"dummy"
);
cta
::
log
::
DummyLogger
dummyLogger
(
"dummy"
,
"dummy"
);
const
auto
login
=
cta
::
rdbms
::
Login
::
parseFile
(
g_cmdLineArgs
.
dbConfigPath
);
const
auto
login
=
cta
::
rdbms
::
Login
::
parseFile
(
g_cmdLineArgs
.
dbConfigPath
);
const
uint64_t
nbConns
=
1
;
const
uint64_t
nbConns
=
1
;
const
uint64_t
nbArchiveFileListingConns
=
1
;
const
uint64_t
nbArchiveFileListingConns
=
1
;
const
uint64_t
maxTriesToConnect
=
1
;
const
uint64_t
maxTriesToConnect
=
1
;
auto
catalogueFactory
=
cta
::
catalogue
::
CatalogueFactoryFactory
::
create
(
dummyLogger
,
login
,
nbConns
,
auto
catalogueFactory
=
cta
::
catalogue
::
CatalogueFactoryFactory
::
create
(
dummyLogger
,
login
,
nbConns
,
nbArchiveFileListingConns
,
maxTriesToConnect
);
nbArchiveFileListingConns
,
maxTriesToConnect
);
g_catalogueFactoryForUnitTests
=
catalogueFactory
.
get
();
g_catalogueFactoryForUnitTests
=
catalogueFactory
.
get
();
const
int
ret
=
RUN_ALL_TESTS
();
const
int
ret
=
RUN_ALL_TESTS
();
// Close standard in, out and error so that valgrind can be used with the
// Close standard in, out and error so that valgrind can be used with the
// following command-line to track open file-descriptors:
// following command-line to track open file-descriptors:
//
//
// valgrind --track-fds=yes
// valgrind --track-fds=yes
close
(
0
);
close
(
0
);
close
(
1
);
close
(
1
);
close
(
2
);
close
(
2
);
return
ret
;
return
ret
;
}
catch
(
cta
::
exception
::
Exception
&
ex
)
{
std
::
cerr
<<
"Aborting: Caught a cta::exception::Exception: "
<<
ex
.
getMessage
().
str
()
<<
std
::
endl
;
return
1
;
}
catch
(
std
::
exception
&
se
)
{
std
::
cerr
<<
"Aborting: Caught an std::exception: "
<<
se
.
what
()
<<
std
::
endl
;
return
1
;
}
catch
(...)
{
std
::
cerr
<<
"Aborting: Caught an unknown exception "
<<
std
::
endl
;
return
1
;
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment