File tree 8 files changed +16
-24
lines changed
8 files changed +16
-24
lines changed Original file line number Diff line number Diff line change @@ -112,13 +112,9 @@ sarus-utest() {
112
112
echo " ${FUNCNAME^^} with:"
113
113
_print_parameters
114
114
115
- if [ ${toolchain_file} = " gcc-asan.cmake" ]; then
116
- privileged_excludes=" GlibcHook"
117
- fi
118
-
119
115
_run_cmd_in_container ${image_run} root \
120
116
" . /sarus-source/CI/utility_functions.bash && \
121
- run_unit_tests $( _build_dir_container) ${privileged_excludes} "
117
+ run_unit_tests $( _build_dir_container) "
122
118
123
119
fail_on_error " ${FUNCNAME} : failed"
124
120
}
Original file line number Diff line number Diff line change @@ -178,20 +178,16 @@ run_sarus_registry() {
178
178
}
179
179
180
180
run_unit_tests () {
181
- local build_dir=$1 ; shift && privileged_excludes= " $1 "
181
+ local build_dir=$1 ; shift || error " ${FUNCNAME} : missing build_dir argument "
182
182
cd ${build_dir}
183
183
184
- if [ ! -z ${privileged_excludes} ]; then
185
- privileged_excludes=(" --exclude-regex" " ${privileged_excludes} " )
186
- fi
187
-
188
184
# Note: use CI/LSan.supp to suppress errors about memory leaks in
189
185
# Sarus dependencies, e.g. OpenSSL. Such leaks are out of our control.
190
186
191
187
sudo -u docker CTEST_OUTPUT_ON_FAILURE=1 ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=suppressions=${build_dir} /../CI/LSan.supp ctest --exclude-regex AsRoot
192
188
fail_on_error " Unit tests as normal user failed"
193
189
194
- CTEST_OUTPUT_ON_FAILURE=1 ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=suppressions=${build_dir} /../CI/LSan.supp ctest --tests-regex AsRoot " ${privileged_excludes[@]} " # Add as many regex as you want with -R. Allow output with -VV.
190
+ CTEST_OUTPUT_ON_FAILURE=1 ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS=suppressions=${build_dir} /../CI/LSan.supp ctest --tests-regex AsRoot # Add as many regex as you want with -R. Allow output with -VV.
195
191
# TODO: allow args forwarding to cpputest so we can run specific testswithin the filtered file with -n for example.
196
192
fail_on_error " Unit tests as root user failed"
197
193
Original file line number Diff line number Diff line change @@ -5,12 +5,4 @@ set(object_files_directory "${CMAKE_BINARY_DIR}/src/hooks/glibc/CMakeFiles/hooks
5
5
6
6
add_unit_test(hooks_glibc_GlibcHook_AsRoot test_GlibcHook.cpp "${link_libraries} " )
7
7
8
- # Link statically only if address sanitizer is not enabled
9
- string (FIND ${CMAKE_CXX_FLAGS} "-fsanitize=address" POS_FOUND)
10
- if (POS_FOUND EQUAL -1)
11
- link_libraries ("-static" )
12
- endif ()
13
-
14
- add_executable (lddMockOlder "lddMockOlder.cpp" )
15
- add_executable (lddMockEqual "lddMockEqual.cpp" )
16
- add_executable (lddMockNewer "lddMockNewer.cpp" )
8
+ add_subdirectory (mocks)
Original file line number Diff line number Diff line change @@ -92,17 +92,17 @@ class Checker {
92
92
}
93
93
94
94
Checker& mockLddWithOlderVersion () {
95
- sarus::common::copyFile (boost::filesystem::current_path () / " lddMockOlder" , rootfsDir / lddPath);
95
+ sarus::common::copyFile (boost::filesystem::current_path () / " mocks/ lddMockOlder" , rootfsDir / lddPath);
96
96
return *this ;
97
97
}
98
98
99
99
Checker& mockLddWithEqualVersion () {
100
- sarus::common::copyFile (boost::filesystem::current_path () / " lddMockEqual" , rootfsDir / lddPath);
100
+ sarus::common::copyFile (boost::filesystem::current_path () / " mocks/ lddMockEqual" , rootfsDir / lddPath);
101
101
return *this ;
102
102
}
103
103
104
104
Checker& mockLddWithNewerVersion () {
105
- sarus::common::copyFile (boost::filesystem::current_path () / " lddMockNewer" , rootfsDir / lddPath);
105
+ sarus::common::copyFile (boost::filesystem::current_path () / " mocks/ lddMockNewer" , rootfsDir / lddPath);
106
106
return *this ;
107
107
}
108
108
@@ -130,7 +130,7 @@ class Checker {
130
130
sarus::common::writeJSON (doc, bundleDir / " config.json" );
131
131
test_utility::ocihooks::writeContainerStateToStdin (bundleDir);
132
132
133
- sarus::common::setEnvironmentVariable (" LDD_PATH=" + (boost::filesystem::current_path () / " lddMockEqual" ).string ());
133
+ sarus::common::setEnvironmentVariable (" LDD_PATH=" + (boost::filesystem::current_path () / " mocks/ lddMockEqual" ).string ());
134
134
sarus::common::setEnvironmentVariable (" LDCONFIG_PATH=ldconfig" );
135
135
sarus::common::setEnvironmentVariable (" READELF_PATH=readelf" );
136
136
sarus::common::setEnvironmentVariable (" GLIBC_LIBS="
Original file line number Diff line number Diff line change
1
+ # Disable sanitizing for static helper binaries mocking ldd
2
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=all" )
3
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize=all" )
4
+ link_libraries ("-static" )
5
+
6
+ add_executable (lddMockOlder "lddMockOlder.cpp" )
7
+ add_executable (lddMockEqual "lddMockEqual.cpp" )
8
+ add_executable (lddMockNewer "lddMockNewer.cpp" )
File renamed without changes.
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments