From 7db645ba72f5711174dbf712003b9600009e5ea7 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 23 Mar 2020 23:57:51 +0100 Subject: [PATCH] tests: Fix getphdrnum and run-lfs-symbols.sh testcase. getphdrnum.c didn't include config.h which is why run-lfs-symbols.sh flagged it for containing bad (non-lfs) symbols. run-lfs-symbols.sh was still checking the libebl modules, which we don't create anymore. But it didn't fail the test for non-existing tests. Add some extra logging and explicitly check files exist. Signed-off-by: Mark Wielaard --- tests/ChangeLog | 6 ++++++ tests/getphdrnum.c | 2 ++ tests/run-lfs-symbols.sh | 27 +++++++++++++++------------ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/tests/ChangeLog b/tests/ChangeLog index 44ea1c44..d0d32a87 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2020-03-23 Mark Wielaard + + * getphdrnum.c: Include config.h. + * run-lfs-symbols.sh: Also check that file exists. Add more logs. + Remove ebl modules check. + 2020-03-22 Omar Sandoval Mark Wielaard diff --git a/tests/getphdrnum.c b/tests/getphdrnum.c index 4d4bb397..07f75db0 100644 --- a/tests/getphdrnum.c +++ b/tests/getphdrnum.c @@ -1,3 +1,5 @@ +#include "config.h" + #include #include #include diff --git a/tests/run-lfs-symbols.sh b/tests/run-lfs-symbols.sh index f0894405..b65391b6 100755 --- a/tests/run-lfs-symbols.sh +++ b/tests/run-lfs-symbols.sh @@ -46,41 +46,44 @@ makeprint() { } testrun_lfs() { - bad=$(testrun ${abs_top_builddir}/src/nm -u "$1" | awk "$LFS") - if [ -n "$bad" ]; then - echo "$1 contains non-lfs symbols:" $bad + echo "checking $1" + if [ -e "$1" ]; then + bad=$(testrun ${abs_top_builddir}/src/nm -u "$1" | awk "$LFS") + if [ -n "$bad" ]; then + echo "$1 contains non-lfs symbols:" $bad + exit_status=1 + fi + else + echo "$1 doesn't exist" exit_status=1 fi } -# First sanity-check that LFS detection works. +echo First sanity-check that LFS detection works. exit_status=0 testrun_lfs ./testfile-nolfs if [ $exit_status -eq 0 ]; then echo "Didn't detect any problem with testfile-nolfs!" exit 99 fi +echo exit_status=0 -# Check all normal build targets. +echo Check all normal build targets. for dir in libelf libdw libasm libcpu src; do dir=${abs_top_builddir}/$dir for program in $(makeprint PROGRAMS $dir); do testrun_lfs $dir/$program done done +echo -# Check all libebl modules. -dir=${abs_top_builddir}/backends -for module in $(makeprint modules $dir); do - testrun_lfs $dir/libebl_$module.so -done - -# Check all test programs. +echo Check all test programs. dir=${abs_builddir} for program in $(makeprint check_PROGRAMS $dir); do testrun_lfs $dir/$program done +echo exit $exit_status -- 2.18.2