@@ -70,6 +70,8 @@ All other options will be tested with all MP_xBIT configurations.
7070 runtime and may trigger the 30 minutes
7171 timeout.
7272
73+ --multithread Run tests in multi-threaded mode (via pthread).
74+
7375Godmode:
7476
7577 --all Choose all architectures and gcc and clang
@@ -128,7 +130,7 @@ _make()
128130 echo -ne " Compile $1 $2 "
129131 suffix=$( echo ${1}${2} | tr ' ' ' _' )
130132 _fixup_cflags " $1 "
131- CC=" $1 " CFLAGS=" $2 $TEST_CFLAGS " make -j$MAKE_JOBS $3 $MAKE_OPTIONS 2> gcc_errors_${suffix} .log
133+ CC=" $1 " CFLAGS=" $2 $TEST_CFLAGS " LFLAGS= " $4 " LDFLAGS= " $5 " make -j$MAKE_JOBS $3 $MAKE_OPTIONS 2> gcc_errors_${suffix} .log
132134 errcnt=$( wc -l < gcc_errors_${suffix} .log)
133135 if [[ ${errcnt} -gt 1 ]]; then
134136 echo " failed"
@@ -148,10 +150,10 @@ _runtest()
148150 # "make tune" will run "tune_it.sh" automatically, hence "autotune", but it cannot
149151 # get switched off without some effort, so we just let it run twice for testing purposes
150152 echo -e " \rRun autotune $1 $2 "
151- _make " $1 " " $2 " " "
153+ _make " $1 " " $2 " " " " $3 " " $4 "
152154 $_timeout $TUNE_CMD > test_${suffix} .log || _die " running autotune" $?
153155 else
154- _make " $1 " " $2 " " test"
156+ _make " $1 " " $2 " " test" " $3 " " $4 "
155157 echo -e " \rRun test $1 $2 "
156158 $_timeout ./test > test_${suffix} .log || _die " running tests" $?
157159 fi
@@ -171,13 +173,13 @@ echo "MAKE_OPTIONS = \"$MAKE_OPTIONS\""
171173 if [[ " $MAKE_OPTIONS " =~ " tune" ]]
172174 then
173175echo " autotune branch"
174- _make " $1 " " $2 " " "
176+ _make " $1 " " $2 " " " " $3 " " $4 "
175177 # The shell used for /bin/sh is DASH 0.5.7-4ubuntu1 on the author's machine which fails valgrind, so
176178 # we just run on instance of etc/tune with the same options as in etc/tune_it.sh
177179 echo -e " \rRun etc/tune $1 $2 once inside valgrind"
178180 $_timeout $VALGRIND_BIN $VALGRIND_OPTS $TUNE_CMD > test_${suffix} .log || _die " running etc/tune" $?
179181 else
180- _make " $1 " " $2 " " test"
182+ _make " $1 " " $2 " " test" " $3 " " $4 "
181183 echo -e " \rRun test $1 $2 inside valgrind"
182184 $_timeout $VALGRIND_BIN $VALGRIND_OPTS ./test > test_${suffix} .log || _die " running tests" $?
183185 fi
301303 --symbols)
302304 CHECK_SYMBOLS=" 1"
303305 ;;
306+ --multithread)
307+ CFLAGS=" $CFLAGS -DLTM_TEST_MULTITHREAD"
308+ LFLAGS=" $LFLAGS -pthread"
309+ LDFLAGS=" $LDFLAGS -pthread"
310+ ;;
304311 --all)
305312 COMPILERS=" gcc clang"
306313 ARCHFLAGS=" -m64 -m32 -mx32"
376383 _banner " $CC "
377384 if [[ " $VALGRIND_BIN " != " " ]]
378385 then
379- _runvalgrind " $CC " " "
386+ _runvalgrind " $CC " " " " $LFLAGS " " $LDFLAGS "
380387 else
381- _runtest " $CC " " "
388+ _runtest " $CC " " " " $LFLAGS " " $LDFLAGS "
382389 fi
383390 _exit
384391fi
@@ -398,9 +405,9 @@ _banner
398405if [[ " $TEST_VS_MTEST " != " " ]]
399406then
400407 make clean > /dev/null
401- _make " ${compilers[0]} " " ${archflags[0]} $CFLAGS " " mtest_opponent"
408+ _make " ${compilers[0]} " " ${archflags[0]} $CFLAGS " " mtest_opponent" " $LFLAGS " " $LDFLAGS "
402409 echo
403- _make " gcc" " $MTEST_RAND " " mtest"
410+ _make " gcc" " $MTEST_RAND " " mtest" " $LFLAGS " " $LDFLAGS "
404411 echo
405412 echo " Run test vs. mtest for $TEST_VS_MTEST iterations"
406413 _timeout=" "
429436 fi
430437 if [[ " $VALGRIND_BIN " != " " ]]
431438 then
432- _runvalgrind " $i " " $a $CFLAGS "
439+ _runvalgrind " $i " " $a $CFLAGS " " $LFLAGS " " $LDFLAGS "
433440 [ " $WITH_LOW_MP " != " 1" ] && continue
434- _runvalgrind " $i " " $a -DMP_16BIT $CFLAGS "
435- _runvalgrind " $i " " $a -DMP_32BIT $CFLAGS "
441+ _runvalgrind " $i " " $a -DMP_16BIT $CFLAGS " " $LFLAGS " " $LDFLAGS "
442+ _runvalgrind " $i " " $a -DMP_32BIT $CFLAGS " " $LFLAGS " " $LDFLAGS "
436443 else
437- _runtest " $i " " $a $CFLAGS "
444+ _runtest " $i " " $a $CFLAGS " " $LFLAGS " " $LDFLAGS "
438445 [ " $WITH_LOW_MP " != " 1" ] && continue
439- _runtest " $i " " $a -DMP_16BIT $CFLAGS "
440- _runtest " $i " " $a -DMP_32BIT $CFLAGS "
446+ _runtest " $i " " $a -DMP_16BIT $CFLAGS " " $LFLAGS " " $LDFLAGS "
447+ _runtest " $i " " $a -DMP_32BIT $CFLAGS " " $LFLAGS " " $LDFLAGS "
441448 fi
442449 done
443450done
0 commit comments