Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix test with ASan.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 30 Jun 2022 13:11:13 +0000 (15:11 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 30 Jun 2022 13:11:13 +0000 (15:11 +0200)
It failed with: ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.

Use ASAN_OPTIONS=verify_asan_link_order=0 instead.

examples/sthread/CMakeLists.txt
examples/sthread/pthread-mutex-simple.tesh

index 784b55a..bf915fc 100644 (file)
@@ -13,7 +13,7 @@ foreach(x
     target_link_libraries(pthread-${x} PRIVATE Threads::Threads)
 
     add_dependencies(tests pthread-${x})
     target_link_libraries(pthread-${x} PRIVATE Threads::Threads)
 
     add_dependencies(tests pthread-${x})
-    ADD_TESH_FACTORIES(pthread-${x} "^thread" --setenv LD_PRELOAD=${CMAKE_BINARY_DIR}/lib/libsthread.so --cd ${CMAKE_BINARY_DIR}/examples/sthread ${CMAKE_CURRENT_SOURCE_DIR}/pthread-${x}.tesh)
+    ADD_TESH_FACTORIES(pthread-${x} "^thread" --setenv libdir=${CMAKE_BINARY_DIR}/lib --cd ${CMAKE_BINARY_DIR}/examples/sthread ${CMAKE_CURRENT_SOURCE_DIR}/pthread-${x}.tesh)
   endif()
 
   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/pthread-${x}.tesh)
   endif()
 
   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/pthread-${x}.tesh)
index b3bba4d..1dd09bd 100644 (file)
@@ -1,7 +1,7 @@
-$ ./pthread-mutex-simple
+$ env ASAN_OPTIONS=verify_asan_link_order=0:$ASAN_OPTIONS LD_PRELOAD=${libdir:=.}/libsthread.so ./pthread-mutex-simple
 > [0.000000] [sthread/INFO] Starting the simulation.
 > The thread 0 is terminating.
 > All threads are started.
 > The thread 1 is terminating.
 > User's main is terminating.
 > [0.000000] [sthread/INFO] Starting the simulation.
 > The thread 0 is terminating.
 > All threads are started.
 > The thread 1 is terminating.
 > User's main is terminating.
-> [0.000000] [sthread/INFO] All threads exited. Terminating the simulation.
\ No newline at end of file
+> [0.000000] [sthread/INFO] All threads exited. Terminating the simulation.