3 # Test capturing and applying a WIM image in the normal (non-NTFS) capture mode
5 # Add in some tests with WIM splitting, joining, and exporting as well.
7 # Test all three compression modes (None, XPRESS, and LZX).
9 # Also, test if the capture configuration file works correctly.
13 srcdir="${srcdir:-.}/.."
14 srcdir="$(cd $srcdir; pwd)"
18 ../imagex "$@" > /dev/null
31 rm -rf in.dir out.dir test*.wim test*.swm
35 echo "****************************************************************"
38 echo "****************************************************************"
43 ../imagex info $1 | grep Compression | awk '{print $2}'
47 if ! ./tree-cmp in.dir out.dir; then
48 if [ -x /usr/bin/tree ]; then
49 echo "Dumping tree of applied image"
50 echo "(Note: compression type was $ctype)"
51 tree out.dir --inodes -F -s --noreport
52 error 'Information was lost or corrupted while capturing
53 and then applying a directory tree'
60 for ctype in None LZX XPRESS; do
62 # Can we capture the WIM, apply it, and get the same result?
66 if [ -x /usr/bin/tree -a "$ctype" = "None" ]; then
67 tree in.dir --inodes -F -s --noreport
69 if ! imagex capture in.dir test.wim --compress=$ctype; then
70 error "Failed to capture directory tree into a WIM"
72 if ! imagex apply test.wim 1 out.dir; then
73 error "Failed to apply WIM to directory"
75 if [ `wim_ctype test.wim` != $ctype ]; then
76 error "'imagex info' didn't report the compression type on the captured WIM correctly"
81 # Can we split the WIM, apply the split WIM, join the split WIM,
82 # and apply the joined WIM, and get the same results every time?
83 if ! imagex split test.wim test.swm 0.01; then
84 error "Failed to split WIM"
86 if ! imagex apply test.swm 1 out.dir --ref "test*.swm" ; then
87 error "Failed to apply split WIM"
90 rm -rf out.dir/* test.wim
91 if ! imagex join test.wim test*.swm; then
92 error "Failed to join split WIM"
94 if ! imagex apply test.wim out.dir; then
95 error "Failed to apply joined WIM"
100 # Can we export the image to another WIM, apply it, and get the
102 (( image_name++ )) || true
103 if ! imagex export test.wim 1 test2.wim "$image_name"; then
104 error "Failed to export WIM image"
107 if ! imagex apply test2.wim "$image_name" out.dir; then
108 error "Failed to apply exported WIM image"
112 rm -rf out.dir/* in.dir/* test.wim test*.swm
118 echo "--------------------------------------------------------------------"
120 echo "--------------------------------------------------------------------"
124 __msg "Testing image capture and application of directory containing $1"
130 . $srcdir/tests/common_tests.sh
132 # Make sure exclusion list works
133 __msg "Testing default capture configuration file"
134 touch in.dir/hiberfil.sys
135 mkdir -p "in.dir/System Volume Information/subdir"
136 imagex capture in.dir test.wim
137 imagex apply test.wim out.dir
138 if [ -e out.dir/hiberfil.sys -o -e "out.dir/System Volume Information" ]; then
139 error "Files were not excluded from capture as expected"
141 rm -rf out.dir/* in.dir/*
145 echo "**********************************************************"
146 echo " imagex capture/apply tests passed "
147 echo "**********************************************************"