Debian Codegraph @

debian/tests/libb64-dev

raw
1 #!/bin/sh
2
3 log_begin()
4 {
5 printf ' %s ... ' "$*"
6 }
7
8 log_end()
9 {
10 if [ -n "$*" ]
11 then
12 printf 'ok\n'
13 return 0
14 else
15 printf 'FAIL\n'
16 return 1
17 fi
18 }
19
20 set -e -u
21 export LC_ALL=C
22 rc=0
23 build_time=
24 make_flags=-s
25 if [ "$*" = '--build-time' ]
26 then
27 build_time=build-time
28 ADTTMP=debian/tmp/adt/
29 mkdir -p $ADTTMP
30 rm -rf $ADTTMP/*
31 fi
32 cp -a base64/ "$ADTTMP/cmdline"
33 cd "$ADTTMP"
34 if [ -z "$build_time" ]
35 then
36 make $make_flags -C cmdline
37 # Check if it's dynamically linked:
38 log_begin 'dynamic linking to libb64'
39 ok=yes
40 ldd cmdline/base64 | grep -w libb64.so >/dev/null || ok=
41 log_end $ok || rc=1
42 fi
43 ln -sf /bin/sh big.orig
44 printf 'x' > tiny.orig
45 for tc in *.orig
46 do
47 base=${tc%.orig}
48 # ---------
49 log_begin "$base: decoder"
50 ok=yes
51 base64 $base.orig > $base.coreutils
52 cmdline/base64 -d $base.coreutils $base.coreutils.libb64 || ok=
53 cmp $base.orig $base.coreutils.libb64 || ok=
54 log_end $ok || rc=1
55 # ---------
56 log_begin "$base: encoder"
57 ok=yes
58 cmdline/base64 -e $base.orig $base.libb64 || ok=
59 base64 -d $base.libb64 > $base.libb64.coreutils || ok=
60 cmp $base.orig $base.libb64.coreutils || ok=
61 log_end $ok || rc=1
62 # ---------
63 log_begin "$base: round-trip"
64 ok=yes
65 cmdline/base64 -d $base.libb64 $base.libb64.libb64 || ok=
66 cmp $base.orig $base.libb64.libb64 || ok=
67 log_end $ok || rc=1
68 done
69 exit $rc
70
71 # vim:ts=4 sw=4 et