]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/build-sys/config
bc48c509d07995eaaf4903700d54b9deee549461
[thirdparty/util-linux.git] / tests / ts / build-sys / config
1 #!/bin/bash
2
3 # Copyright (C) 2011 Karel Zak <kzak@redhat.com>
4
5 TS_TOPDIR="${0%/*}/../.."
6 TS_DESC="config"
7
8 # Don't execute this test by default, --force required
9 TS_OPTIONAL="yes"
10
11 . $TS_TOPDIR/functions.sh
12 ts_init "$*"
13
14 ts_check_prog "readelf"
15 ts_check_prog "file"
16
17 config_gen_dir="$top_srcdir/tools"
18 . $config_gen_dir/config-gen-functions.sh
19
20 [ -n "$CFLAGS" ] && export CFLAGS="$CFLAGS"
21
22 ts_cd $top_builddir && make -j clean &> /dev/null
23
24 for conf in $config_gen_dir/config-gen.d/*.conf; do
25 ts_init_subtest $(basename $conf | sed 's/\.conf//')
26
27 opts=$(ul_get_configuration $conf)
28
29 olddir=$(pwd)
30 ts_cd $top_builddir
31
32 ./configure $opts &> /dev/null
33 make -j &> /dev/null
34
35 bins=$(find . -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \) | sort)
36 for b in $bins; do
37 libs=$(readelf --dynamic $b 2> /dev/null | \
38 awk '/NEEDED/ { print $5 }' | \
39 sed 's:\[::g; s:\..*::g; s:libc::g; s:ld\-.*::g' | \
40 sort -u | tr '\n' ' ')
41
42 if [ -n "$libs" ]; then
43 echo "$(basename $b): $libs" >> $TS_OUTPUT
44 else
45 fres=$(file $b)
46 case $fres in
47 *statically*)
48 echo "$(basename $b): STATIC" >> $TS_OUTPUT
49 ;;
50 *) # ignore scripts, ...etc.
51 ;;
52 esac
53 fi
54 done
55
56 # clean the tree, but exclude tests/{diff,output} dirs
57 #
58 [ -d tests/diff ] && mv tests/diff tests/diff.save
59 [ -d tests/output ] && mv tests/output tests/output.save
60
61 make -j clean &> /dev/null
62
63 [ -d tests/diff.save ] && mv tests/diff.save tests/diff
64 [ -d tests/output.save ] && mv tests/output.save tests/output
65
66 ts_cd $olddir
67 ts_finalize_subtest
68 done
69
70 ts_finalize