Update version-info
[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 wimlib_imagex()
35 {
36         ../../wimlib-imagex "$@"
37 }
38
39 wimappend()
40 {
41         wimlib_imagex append "$@" > null
42 }
43
44 wimapply()
45 {
46         wimlib_imagex apply "$@" > null
47 }
48
49 wimcapture()
50 {
51         wimlib_imagex capture "$@" > null
52 }
53
54 wimdelete()
55 {
56         wimlib_imagex delete "$@" > null
57 }
58
59 wimdir()
60 {
61         wimlib_imagex dir "$@"
62 }
63
64 wimexport()
65 {
66         wimlib_imagex export "$@" > null
67 }
68
69 wimextract()
70 {
71         wimlib_imagex extract "$@" > null
72 }
73
74 wiminfo()
75 {
76         wimlib_imagex info "$@"
77 }
78
79 wimjoin()
80 {
81         wimlib_imagex join "$@" > null
82 }
83
84 wimmount()
85 {
86         wimlib_imagex mount "$@" > null
87 }
88
89 wimmountrw()
90 {
91         wimlib_imagex mountrw "$@" > null
92 }
93
94 wimoptimize()
95 {
96         wimlib_imagex optimize "$@" > null
97 }
98
99 wimsplit()
100 {
101         wimlib_imagex split "$@" > null
102 }
103
104 wimunmount()
105 {
106         wimlib_imagex unmount "$@" > null
107 }
108
109 wimupdate()
110 {
111         wimlib_imagex update "$@" > null
112 }
113
114 wimverify()
115 {
116         wimlib_imagex verify "$@" > null
117 }
118
119 wim_ctype()
120 {
121         wiminfo $1 | grep Compression | awk '{print $2}'
122 }
123
124 default_cleanup()
125 {
126         rm -rf $TEST_SUBDIR
127 }
128
129 error()
130 {
131         echo "****************************************************************"
132         echo "                         Test failure                           "
133         echo $*
134         echo "****************************************************************"
135         exit 1
136 }