Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
576612b7
Commit
576612b7
authored
5 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Improved the exception handling within the main() function of cta-rdbmsUnitTests
parent
3ade134f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/rdbmsUnitTests.cpp
+33
-22
33 additions, 22 deletions
tests/rdbmsUnitTests.cpp
with
33 additions
and
22 deletions
tests/rdbmsUnitTests.cpp
+
33
−
22
View file @
576612b7
...
...
@@ -54,31 +54,42 @@ static RdbmsUnitTestsCmdLineArgs parseCmdLine(const int argc, char ** argv) {
}
int
main
(
int
argc
,
char
**
argv
)
{
// The following line must be executed to initialize Google Mock
// (and Google Test) before running the tests.
::
testing
::
InitGoogleMock
(
&
argc
,
argv
);
try
{
// The following line must be executed to initialize Google Mock
// (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
g_cmdLineArgs
=
parseCmdLine
(
argc
,
argv
);
// Google test will consume its options from the command-line and leave everything else
g_cmdLineArgs
=
parseCmdLine
(
argc
,
argv
);
cta
::
log
::
DummyLogger
dummyLogger
(
"dummy"
,
"dummy"
);
const
auto
login
=
cta
::
rdbms
::
Login
::
parseFile
(
g_cmdLineArgs
.
dbConfigPath
);
const
uint64_t
nbConns
=
1
;
const
uint64_t
nbArchiveFileListingConns
=
1
;
const
uint64_t
maxTriesToConnect
=
1
;
auto
catalogueFactory
=
cta
::
catalogue
::
CatalogueFactoryFactory
::
create
(
dummyLogger
,
login
,
nbConns
,
nbArchiveFileListingConns
,
maxTriesToConnect
);
g_catalogueFactoryForUnitTests
=
catalogueFactory
.
get
();
cta
::
log
::
DummyLogger
dummyLogger
(
"dummy"
,
"dummy"
);
const
auto
login
=
cta
::
rdbms
::
Login
::
parseFile
(
g_cmdLineArgs
.
dbConfigPath
);
const
uint64_t
nbConns
=
1
;
const
uint64_t
nbArchiveFileListingConns
=
1
;
const
uint64_t
maxTriesToConnect
=
1
;
auto
catalogueFactory
=
cta
::
catalogue
::
CatalogueFactoryFactory
::
create
(
dummyLogger
,
login
,
nbConns
,
nbArchiveFileListingConns
,
maxTriesToConnect
);
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
// following command-line to track open file-descriptors:
//
// valgrind --track-fds=yes
close
(
0
);
close
(
1
);
close
(
2
);
// Close standard in, out and error so that valgrind can be used with the
// following command-line to track open file-descriptors:
//
// valgrind --track-fds=yes
close
(
0
);
close
(
1
);
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
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment