LZMS: decompression optimizations
[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                 ../../wimlib-imagex "$@"
39         else
40                 ../../wimlib-imagex "$@" > /dev/null
41         fi
42 }
43
44 imagex_raw()
45 {
46         ../../wimlib-imagex "$@"
47 }
48
49 wim_ctype()
50 {
51         imagex info $1 | grep Compression | awk '{print $2}'
52 }
53
54 default_cleanup()
55 {
56         rm -rf $TEST_SUBDIR
57 }
58
59 error()
60 {
61         echo "****************************************************************"
62         echo "                         Test failure                           "
63         echo $*
64         echo "****************************************************************"
65         exit 1
66 }