Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
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
Model registry
Operate
Environments
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
code
pugs
Commits
0887dbcc
Commit
0887dbcc
authored
7 months ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for stop function
parent
fc82cae0
No related branches found
No related tags found
1 merge request
!199
Integrate checkpointing
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/utils/Stop.cpp
+2
-0
2 additions, 0 deletions
src/utils/Stop.cpp
tests/CMakeLists.txt
+1
-0
1 addition, 0 deletions
tests/CMakeLists.txt
tests/test_Stop.cpp
+36
-0
36 additions, 0 deletions
tests/test_Stop.cpp
with
39 additions
and
0 deletions
src/utils/Stop.cpp
+
2
−
0
View file @
0887dbcc
...
@@ -30,6 +30,7 @@ stop()
...
@@ -30,6 +30,7 @@ stop()
}
}
#ifdef PUGS_HAS_SLURM
#ifdef PUGS_HAS_SLURM
// LCOV_EXCL_START
char
*
env
=
getenv
(
"SLURM_JOB_ID"
);
char
*
env
=
getenv
(
"SLURM_JOB_ID"
);
if
(
env
!=
nullptr
)
{
if
(
env
!=
nullptr
)
{
slurm_init
(
nullptr
);
slurm_init
(
nullptr
);
...
@@ -41,6 +42,7 @@ stop()
...
@@ -41,6 +42,7 @@ stop()
slurm_fini
();
slurm_fini
();
}
}
// LCOV_EXCL_STOP
#endif // PUGS_HAS_SLURM
#endif // PUGS_HAS_SLURM
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/CMakeLists.txt
+
1
−
0
View file @
0887dbcc
...
@@ -147,6 +147,7 @@ add_executable (unit_tests
...
@@ -147,6 +147,7 @@ add_executable (unit_tests
test_SourceLocation.cpp
test_SourceLocation.cpp
test_SquareGaussQuadrature.cpp
test_SquareGaussQuadrature.cpp
test_SquareTransformation.cpp
test_SquareTransformation.cpp
test_Stop.cpp
test_SymbolTable.cpp
test_SymbolTable.cpp
test_Table.cpp
test_Table.cpp
test_TetrahedronGaussQuadrature.cpp
test_TetrahedronGaussQuadrature.cpp
...
...
This diff is collapsed.
Click to expand it.
tests/test_Stop.cpp
0 → 100644
+
36
−
0
View file @
0887dbcc
#include
<catch2/catch_test_macros.hpp>
#include
<catch2/matchers/catch_matchers_all.hpp>
#include
<utils/ExecutionStatManager.hpp>
#include
<utils/Stop.hpp>
#include
<chrono>
#include
<filesystem>
#include
<fstream>
// clazy:excludeall=non-pod-global-static
TEST_CASE
(
"Stop"
,
"[utils]"
)
{
ExecutionStatManager
::
create
();
auto
stop_file
=
std
::
filesystem
::
current_path
()
/
"stop"
;
std
::
filesystem
::
remove
(
stop_file
);
REQUIRE
(
not
std
::
filesystem
::
exists
(
stop_file
));
REQUIRE
(
not
stop
());
std
::
ofstream
{
stop_file
.
c_str
()}.
put
(
'a'
);
REQUIRE
(
std
::
filesystem
::
exists
(
stop_file
));
std
::
filesystem
::
file_time_type
ftime
=
std
::
filesystem
::
last_write_time
(
stop_file
);
using
namespace
std
::
chrono_literals
;
std
::
filesystem
::
last_write_time
(
stop_file
,
ftime
-
1h
);
REQUIRE
(
not
stop
());
std
::
filesystem
::
last_write_time
(
stop_file
,
ftime
);
REQUIRE
(
stop
());
ExecutionStatManager
::
destroy
();
}
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