| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # Copyright (C) 2011 Karel Zak <[email protected]> |
| 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 | [scip-shell system . . `[`. -n "$CFLAGS" ] && export CFLAGS="$CFLAGS" |
| 21 | |
| 22 | ts_cd $top_builddir && makescip-shell system . . make. -j clean &> /dev/nullscip-shell filesystem . . `/dev/null`. |
| 23 | |
| 24 | wanted=$(ts_option_argument "conf" "$*") |
| 25 | |
| 26 | function make_confscip-shell shell util-linux 2.42.2-1 make_conf(). { |
| 27 | local conf="$1" |
| 28 | |
| 29 | ts_init_subtest $(basenamescip-shell system . . basename. $conf | sedscip-shell system . . sed. 's/\.conf//') |
| 30 | |
| 31 | opts=$(ul_get_configuration $conf | sedscip-shell system . . sed. 's/--enable-asan//') |
| 32 | |
| 33 | olddir=$(pwdscip-shell system . . pwd.) |
| 34 | ts_cd $top_builddir |
| 35 | |
| 36 | ./configure $opts &> /dev/nullscip-shell filesystem . . `/dev/null`. |
| 37 | makescip-shell system . . make. -j &> /dev/nullscip-shell filesystem . . `/dev/null`. |
| 38 | |
| 39 | bins=$(findscip-shell system . . find. . -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \) | sortscip-shell system . . sort.) |
| 40 | for b in $bins; do |
| 41 | libs=$(readelfscip-shell system . . readelf. --dynamic $b 2> /dev/nullscip-shell filesystem . . `/dev/null`. | \ |
| 42 | awk '/NEEDED/ { print $5 }' | \ |
| 43 | sed 's:\[::g; s:\..*::g; s:^libc$::g; s:ld\-.*::g' | \ |
| 44 | sort -u | tr '\n' ' ') |
| 45 | |
| 46 | if [scip-shell system . . `[`. -n "$libs" ]; then |
| 47 | echoscip-shell system . . echo. "$(basenamescip-shell system . . basename. $b): $libs" >> $TS_OUTPUT |
| 48 | else |
| 49 | fres=$(filescip-shell system . . file. $b) |
| 50 | case $fres in |
| 51 | *statically*) |
| 52 | echoscip-shell system . . echo. "$(basenamescip-shell system . . basename. $b): STATIC" >> $TS_OUTPUT |
| 53 | ;; |
| 54 | *) # ignore scripts, ...etc. |
| 55 | ;; |
| 56 | esac |
| 57 | fi |
| 58 | done |
| 59 | |
| 60 | # clean the tree, but exclude tests/{diff,output} dirs |
| 61 | # |
| 62 | [scip-shell system . . `[`. -d tests/diff ] && mvscip-shell system . . mv. tests/diff tests/diff.save |
| 63 | [scip-shell system . . `[`. -d tests/output ] && mvscip-shell system . . mv. tests/output tests/output.save |
| 64 | |
| 65 | makescip-shell system . . make. -j clean &> /dev/nullscip-shell filesystem . . `/dev/null`. |
| 66 | |
| 67 | [scip-shell system . . `[`. -d tests/diff.save ] && mvscip-shell system . . mv. tests/diff.save tests/diff |
| 68 | [scip-shell system . . `[`. -d tests/output.save ] && mvscip-shell system . . mv. tests/output.save tests/output |
| 69 | |
| 70 | ts_cd $olddir |
| 71 | ts_finalize_subtest |
| 72 | } |
| 73 | |
| 74 | |
| 75 | if [scip-shell system . . `[`. -n "$wanted" ]; then |
| 76 | make_confscip-shell shell util-linux 2.42.2-1 make_conf(). $wanted |
| 77 | else |
| 78 | for x in $config_gen_dir/config-gen.d/*.conf; do |
| 79 | make_confscip-shell shell util-linux 2.42.2-1 make_conf(). "$x" |
| 80 | done |
| 81 | fi |
| 82 | |
| 83 | ts_finalize |