]> wimlib.net Git - wimlib/blob - tools/test-examples
Improved handling of Data Deduplication reparse points
[wimlib] / tools / test-examples
1 #!/bin/sh
2 #
3 # Try building the example programs: in 32-bit and 64-bit mode, in C and C++
4 # mode, and for Linux and for Windows.  Also run the Linux versions to make sure
5 # they work.
6 #
7
8 set -eu
9
10 cd examples
11 make clean
12
13 COMMON_FLAGS="-Wall -Wextra -Werror -Wundef -Wno-unused-parameter -Wvla"
14 COMMON_CFLAGS="$COMMON_FLAGS -std=gnu99 -Wdeclaration-after-statement -Wstrict-prototypes"
15 COMMON_CXXFLAGS="$COMMON_FLAGS"
16
17 TEST_WIM="$HOME/data/test.wim"
18 TESTDATA="$HOME/data/testdata"
19
20 tmpdir="$(mktemp -d)"
21 tmpfile="$(mktemp)"
22 tmpfile2="$(mktemp)"
23
24 trap "rm -rf \"$tmpdir\" \"$tmpfile\" \"$tmpfile2\"" EXIT
25
26 do_test() {
27         rm -rf "$tmpdir"
28
29         ./applywim "$TEST_WIM" "$tmpdir"
30         ./capturewim "$tmpdir" "$tmpfile"
31         ./updatewim "$tmpfile" "examples" .
32
33         ./compressfile "$TESTDATA" "$tmpfile"
34         ./decompressfile "$tmpfile" "$tmpfile2"
35         cmp "$tmpfile2" "$TESTDATA"
36
37         ./compressfile "$TESTDATA" "$tmpfile" XPRESS 16384
38         ./decompressfile "$tmpfile" "$tmpfile2"
39         cmp "$tmpfile2" "$TESTDATA"
40 }
41
42 make CC=gcc CFLAGS="$COMMON_CFLAGS"
43 do_test
44 make clean
45 make CC=g++ CFLAGS="$COMMON_CXXFLAGS"
46 do_test
47 make clean
48
49 make CC=i686-w64-mingw32-gcc CFLAGS="$COMMON_CFLAGS -I../include -municode" LDLIBS="-lwim-15" LDFLAGS="-L/j/wimlib"
50 make clean
51 make CC=i686-w64-mingw32-g++ CFLAGS="$COMMON_CXXFLAGS -I../include -municode" LDLIBS="-lwim-15" LDFLAGS="-L/j/wimlib"
52 make clean
53
54 make CC=x86_64-w64-mingw32-gcc CFLAGS="$COMMON_CFLAGS -I../include -municode" LDLIBS="-lwim-15" LDFLAGS="-L/j/x64"
55 make clean
56 make CC=x86_64-w64-mingw32-g++ CFLAGS="$COMMON_CXXFLAGS -I../include -municode" LDLIBS="-lwim-15" LDFLAGS="-L/j/x64"
57 make clean