]> wimlib.net Git - wimlib/blob - tests/tests-common.sh
test-imagex: Use existing image for changing boot index of split WIM
[wimlib] / tests / tests-common.sh
1 if stat -c %i . &> /dev/null ; then
2         BSD_STAT=0
3 else
4         BSD_STAT=1
5 fi
6
7 get_inode_number()
8 {
9         if [ "$BSD_STAT" -eq 1 ]; then
10                 stat -f %i "$1"
11         else
12                 stat -c %i "$1"
13         fi
14 }
15
16 get_link_count()
17 {
18         if [ "$BSD_STAT" -eq 1 ]; then
19                 stat -f %l "$1"
20         else
21                 stat -c %h "$1"
22         fi
23 }
24
25 get_file_size()
26 {
27         if [ "$BSD_STAT" -eq 1 ]; then
28                 stat -f %z "$1"
29         else
30                 stat -c %s "$1"
31         fi
32 }
33
34 imagex()
35 {
36         echo "imagex $@"
37         if [[ $1 == info || $1 == mountrw ]]; then
38                 ../../imagex "$@"
39         else
40                 ../../imagex "$@" > /dev/null
41         fi
42 }
43
44 wim_ctype()
45 {
46         imagex info $1 | grep Compression | awk '{print $2}'
47 }
48
49 default_cleanup()
50 {
51         rm -rf $TEST_SUBDIR
52 }
53
54 error()
55 {
56         echo "****************************************************************"
57         echo "                         Test failure                           "
58         echo $*
59         echo "****************************************************************"
60         exit 1
61 }