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.
17 ../imagex "$@" > /dev/null
30 rm -rf in.dir out.dir test*.wim test*.swm
34 echo "****************************************************************"
37 echo "****************************************************************"
42 ../imagex info $1 | grep Compression | awk '{print $2}'
46 if ! ./tree-cmp in.dir out.dir; then
47 if [ -x /usr/bin/tree ]; then
48 echo "Dumping tree of applied image"
49 echo "(Note: compression type was $ctype)"
50 tree out.dir --inodes -F -s --noreport
51 error 'Information was lost or corrupted while capturing
52 and then applying a directory tree'
59 for ctype in None LZX XPRESS; do
61 # Can we capture the WIM, apply it, and get the same result?
65 if [ -x /usr/bin/tree -a "$ctype" = "None" ]; then
66 tree in.dir --inodes -F -s --noreport
68 if ! imagex capture in.dir test.wim --compress=$ctype; then
69 error "Failed to capture directory tree into a WIM"
71 if ! imagex apply test.wim 1 out.dir; then
72 error "Failed to apply WIM to directory"
74 if [ `wim_ctype test.wim` != $ctype ]; then
75 error "'imagex info' didn't report the compression type on the captured WIM correctly"
80 # Can we split the WIM, apply the split WIM, join the split WIM,
81 # and apply the joined WIM, and get the same results every time?
82 if ! imagex split test.wim test.swm 0.01; then
83 error "Failed to split WIM"
85 if ! imagex apply test.swm 1 out.dir --ref "test*.swm" ; then
86 error "Failed to apply split WIM"
89 rm -rf out.dir/* test.wim
90 if ! imagex join test.wim test*.swm; then
91 error "Failed to join split WIM"
93 if ! imagex apply test.wim out.dir; then
94 error "Failed to apply joined WIM"
99 # Can we export the image to another WIM, apply it, and get the
101 (( image_name++ )) || true
102 if ! imagex export test.wim 1 test2.wim "$image_name"; then
103 error "Failed to export WIM image"
106 if ! imagex apply test2.wim "$image_name" out.dir; then
107 error "Failed to apply exported WIM image"
111 rm -rf out.dir/* in.dir/* test.wim test*.swm
117 echo "--------------------------------------------------------------------"
119 echo "--------------------------------------------------------------------"
123 __msg "Testing image capture and application of directory containing $1"
129 . $srcdir/tests/common_tests.sh
131 # Make sure exclusion list works
132 __msg "Testing default capture configuration file"
133 touch in.dir/hiberfil.sys
134 mkdir -p "in.dir/System Volume Information/subdir"
135 imagex capture in.dir test.wim
136 imagex apply test.wim out.dir
137 if [ -e out.dir/hiberfil.sys -o -e "out.dir/System Volume Information" ]; then
138 error "Files were not excluded from capture as expected"
140 rm -rf out.dir/* in.dir/*
144 echo "**********************************************************"
145 echo " imagex capture/apply tests passed "
146 echo "**********************************************************"