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)"
15 . "$srcdir/tests/tests-common.sh"
20 ../imagex "$@" > /dev/null
33 rm -rf in.dir out.dir test*.wim test*.swm
37 echo "****************************************************************"
40 echo "****************************************************************"
45 ../imagex info $1 | grep Compression | awk '{print $2}'
49 if ! ./tree-cmp in.dir out.dir; then
50 if [ -x /usr/bin/tree ]; then
51 echo "Dumping tree of applied image"
52 echo "(Note: compression type was $ctype)"
53 tree out.dir --inodes -F -s --noreport
54 error 'Information was lost or corrupted while capturing
55 and then applying a directory tree'
62 for ctype in None LZX XPRESS; do
64 # Can we capture the WIM, apply it, and get the same result?
68 if [ -x /usr/bin/tree -a "$ctype" = "None" ]; then
69 tree in.dir --inodes -F -s --noreport
71 if ! imagex capture in.dir test.wim --compress=$ctype; then
72 error "Failed to capture directory tree into a WIM"
74 if ! imagex apply test.wim 1 out.dir; then
75 error "Failed to apply WIM to directory"
77 if [ `wim_ctype test.wim` != $ctype ]; then
78 error "'imagex info' didn't report the compression type on the captured WIM correctly"
83 # Can we split the WIM, apply the split WIM, join the split WIM,
84 # and apply the joined WIM, and get the same results every time?
85 if ! imagex split test.wim test.swm 0.01; then
86 error "Failed to split WIM"
88 if ! imagex apply test.swm 1 out.dir --ref "test*.swm" ; then
89 error "Failed to apply split WIM"
92 rm -rf out.dir/* test.wim
93 if ! imagex join test.wim test*.swm; then
94 error "Failed to join split WIM"
96 if ! imagex apply test.wim out.dir; then
97 error "Failed to apply joined WIM"
102 # Can we export the image to another WIM, apply it, and get the
104 (( image_name++ )) || true
105 if ! imagex export test.wim 1 test2.wim "$image_name"; then
106 error "Failed to export WIM image"
109 if ! imagex apply test2.wim "$image_name" out.dir; then
110 error "Failed to apply exported WIM image"
114 rm -rf out.dir/* in.dir/* test.wim test*.swm
120 echo "--------------------------------------------------------------------"
122 echo "--------------------------------------------------------------------"
126 __msg "Testing image capture and application of directory containing $1"
132 . $srcdir/tests/common_tests.sh
134 # Make sure exclusion list works
135 __msg "Testing default capture configuration file"
136 touch in.dir/hiberfil.sys
137 mkdir -p "in.dir/System Volume Information/subdir"
138 imagex capture in.dir test.wim
139 imagex apply test.wim out.dir
140 if [ -e out.dir/hiberfil.sys -o -e "out.dir/System Volume Information" ]; then
141 error "Files were not excluded from capture as expected"
143 rm -rf out.dir/* in.dir/*
147 echo "**********************************************************"
148 echo " imagex capture/apply tests passed "
149 echo "**********************************************************"