]> git.wh0rd.org Git - patches.git/blob - genext2fs-root-test-check.patch
more random patches. who knows.
[patches.git] / genext2fs-root-test-check.patch
1 --- Makefile.am
2 +++ Makefile.am
3 @@ -2,4 +2,4 @@ bin_PROGRAMS = genext2fs
4  genext2fs_SOURCES = genext2fs.c
5  man_MANS = genext2fs.8
6  EXTRA_DIST = $(man_MANS) test-gen.lib test-mount.sh test.sh device_table.txt
7 -TESTS = test.sh
8 +TESTS = test-mount.sh test.sh
9 --- test-gen.lib
10 +++ test-gen.lib
11 @@ -52,3 +52,14 @@ calc_digest () {
12         fi
13  }
14  
15 +if [ "x$NEED_ROOT" = "xyes" ] ; then
16 +       my_uid=`id -u`
17 +       if [ $? != 0 ] ; then
18 +               echo "Failed to run 'id -u'" 1>&2
19 +               exit 1
20 +       fi
21 +       if [ "x$my_uid" != "x0" ] ; then
22 +               echo "Skipping test as this requires root access"
23 +               exit 0
24 +       fi
25 +fi
26 --- test-mount.sh
27 +++ test-mount.sh
28 @@ -6,6 +6,7 @@
29  
30  set -e
31  
32 +NEED_ROOT=yes
33  . ./test-gen.lib
34  
35  test_cleanup () {
36 --- test.sh
37 +++ test.sh
38 @@ -11,6 +11,7 @@
39  
40  set -e
41  
42 +NEED_ROOT=no
43  . ./test-gen.lib
44  
45  # md5cmp - Calculate MD5 digest and compare it to an expected value.