]> wimlib.net Git - wimlib/blob - tests/test-imagex
Fix various issues
[wimlib] / tests / test-imagex
1 #!/bin/sh
2
3 # This script does some sanity testing of the 'imagex' program.  It by no means
4 # tests every aspect of wimlib comprehensively.
5
6 # Assume an in-tree build.
7 set -e
8 cd tests
9
10 imagex() {
11         echo "imagex $@"
12         ../imagex $@
13 }
14
15 cleanup() {
16         if [ -d tmp ] && mountpoint tmp > /dev/null; then
17                 fusermount -u tmp > /dev/null;
18         fi
19         rm -rf dir* tmp* *.wim *.swm
20 }
21 trap cleanup exit
22 fusermount -u tmp || true
23 rm -rf tmp || true
24
25 # Make test directory
26 mkdir dir
27 cp ../src/*.c ../src/*.h dir
28 mkdir dir/subdir
29 echo 'hello' > dir/subdir/hello
30 echo 'hello' > dir/subdir/hello2
31 ln dir/subdir/hello dir/subdir/hellolink
32 echo -n > dir/subdir/empty_file
33 ln -s hello dir/subdir/rel_symlink
34
35 mkdir dir2
36 echo 'testing' > dir2/file
37 dd if=/dev/zero of=dir2/zeroes bs=4096 count=5
38
39 error() {
40         echo "**********************************************"
41         echo "                  Test failure                "
42         echo $*
43         echo "**********************************************"
44         exit 1
45 }
46
47 # Capturing and applying WIM with None, LZX, and XPRESS compression
48
49 for comp_type in None LZX XPRESS; do
50         echo "Testing capture and application of $comp_type-compressed WIM"
51         if ! imagex capture dir dir.wim --compress=$comp_type; then
52                 error "'imagex capture' failed"
53         fi
54         if ! imagex apply dir.wim tmp; then
55                 error "'imagex apply' failed"
56         fi
57         if ! test "`imagex info dir.wim | grep Compression | awk '{print $2}'`" = "$comp_type"; then
58                 error "'imagex info' didn't report the compression type correctly"
59         fi
60         if ! diff -q -r dir tmp; then
61                 error "Recursive diff of extracted directory with original failed"
62         fi
63         if ! test `stat -c %h tmp/subdir/hello` = 2; then
64                 error "Incorrect number of hard links in extracted file"
65         fi
66         if ! test `stat -c %i tmp/subdir/hello` != `stat -c %i tmp/subdir/hello2`; then
67                 error "Expected different inode numbers in files not hard-linked"
68         fi
69         if ! test "`stat -c %i tmp/subdir/hello`" = "`stat -c %i tmp/subdir/hellolink`"; then
70                 error "Expected same inode numbers in hard-linked files"
71         fi
72         if ! test -L tmp/subdir/rel_symlink; then
73                 error "Symlink not extracted correctly"
74         fi
75         if ! test "`readlink tmp/subdir/rel_symlink`" = "hello"; then
76                 error "Symlink target not correct"
77         fi
78         
79         rm -rf dir.wim tmp
80 done
81
82 # Capturing and modifying name, description, and bootable flag
83
84 echo "Testing capture of WIM with default name and description"
85 imagex capture dir dir.wim
86 if ! test "`imagex info dir.wim | grep Name | awk '{print $2}'`" = "dir"; then
87         error "WIM name not set correctly"
88 fi
89 if ! test "`imagex info dir.wim | grep Description | awk '{print $2}'`" = ""; then
90         error "WIM description not set correctly"
91 fi
92
93 echo "Testing capture of WIM with default boot flag"
94 imagex capture dir dir.wim
95 if ! test "`imagex info dir.wim | grep Boot | awk '{print $3}'`" = "0"; then
96         error "WIM boot flag not set correctly"
97 fi
98
99 echo "Testing changing image bootable flag"
100 if ! imagex info dir.wim 1 --boot; then
101         error "Failed to change bootable image"
102 fi
103 if ! test "`imagex info dir.wim | grep Boot | awk '{print $3}'`" = "1"; then
104         error "Bootable image not changed correctly"
105 fi
106 echo "Testing changing image bootable flag"
107 if ! imagex info dir.wim 0 --boot; then
108         error "Failed to reset bootable image"
109 fi
110 if ! test "`imagex info dir.wim | grep Boot | awk '{print $3}'`" = "0"; then
111         error "Bootable image not reset correctly"
112 fi
113 echo "Testing changing image bootable flag to invalid image (this should generate errors)"
114 if imagex info dir.wim 2 --boot; then
115         error "Succeeded in changing bootable image to invalid number"
116 fi
117 if ! test "`imagex info dir.wim | grep Boot | awk '{print $3}'`" = "0"; then
118         error "Boot flag was changed even though the change command was supposed to fail"
119 fi
120 rm -rf dir.wim tmp
121
122 echo "Testing capture of WIM with name and description"
123 if ! imagex capture dir dir.wim "myname" "mydesc"; then
124         error "Failed to capture WIM with specified name and description"
125 fi
126 if ! test "`imagex info dir.wim | grep Name | awk '{print $2}'`" = "myname"; then
127         error "WIM name not set correctly"
128 fi
129 if ! test "`imagex info dir.wim | grep Description | awk '{print $2}'`" = "mydesc"; then
130         error "WIM name not set correctly"
131 fi
132 echo "Testing printing WIM lookup table"
133 if ! imagex info --lookup-table dir.wim > /dev/null; then
134         error "Failed to print WIM lookup table"
135 fi
136 echo "Testing printing WIM header"
137 if ! imagex info --header dir.wim > /dev/null; then
138         error "Failed to print WIM header"
139 fi
140 echo "Testing printing WIM XML info"
141 if ! imagex info --xml dir.wim > /dev/null; then
142         error "Failed to print WIM XML data"
143 fi
144 echo "Testing extracting WIM XML info"
145 if ! imagex info --extract-xml=dir.xml dir.wim; then
146         error "Failed to extract WIM XML data"
147 fi
148 echo "Testing printing WIM metadata"
149 if ! imagex info --metadata dir.wim > /dev/null; then
150         error "Failed to print WIM metadata"
151 fi
152 rm -rf dir.wim tmp dir.xml
153
154 echo "Testing capture of bootable WIM"
155 if ! imagex capture dir dir.wim --boot; then
156         error "Failed to capture bootable WIM"
157 fi
158 if ! test "`imagex info dir.wim | grep Boot | awk '{print $3}'`" = "1"; then
159         error "Boot flag on bootable WIM not set correctly"
160 fi
161 rm -rf dir.wim tmp
162
163 # Integrity table
164
165 echo "Testing capture of WIM with integrity table"
166 if ! imagex capture dir dir.wim --check; then
167         error "Failed to capture WIM with integrity table"
168 fi
169 if ! test "`imagex info dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
170         error "Integrity table on WIM not made"
171 fi
172 if ! imagex apply --check dir.wim tmp; then
173         error "Integrity table on WIM not made correctly"
174 fi
175 if ! diff -q -r dir tmp; then
176         error "Recursive diff of applied WIM with original directory failed"
177 fi
178 rm -rf dir.wim tmp
179
180 # Appending and deleting images
181
182 echo "Testing appending WIM image"
183 imagex capture dir dir.wim
184 if ! imagex append dir2 dir.wim; then
185         error "Appending WIM image failed"
186 fi
187 if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 2; then
188         error "WIM image count not correct"
189 fi
190
191 echo "Testing appending WIM image with existing name (this should generate errors)"
192 if imagex append dir2 dir.wim; then
193         error "Adding duplicate image name didn't fail"
194 fi
195 echo "Testing appending WIM image with new name"
196 if ! imagex append dir2 dir.wim "newname"; then
197         error "Appending WIM image failed"
198 fi
199 echo "Testing appending WIM image with integrity check"
200 if ! imagex append dir2 dir.wim "newname2" --check; then
201         error "Appending WIM image failed"
202 fi
203 if ! test "`imagex info dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
204         error "Integrity table not set correctly on image append"
205 fi
206 echo "Testing appending WIM image with no integrity check"
207 if ! imagex append dir2 dir.wim "newname3"; then
208         error "Appending WIM image failed"
209 fi
210 if ! test "`imagex info dir.wim | grep Integrity | awk '{print $3}'`" = "no"; then
211         error "WIM integrity table not removed"
212 fi
213 # 5 images at this point
214 if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 5; then
215         error "WIM does not contain the expected 5 images"
216 fi
217 echo "Testing deleting first WIM image"
218 if ! imagex delete dir.wim 1; then
219         error "Failed to delete WIM image"
220 fi
221 if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 4; then
222         error "WIM image not deleted correctly"
223 fi
224 echo "Testing deleting last WIM image"
225 if ! imagex delete dir.wim 4; then
226         error "Failed to delete WIM image"
227 fi
228 if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 3; then
229         error "WIM image not deleted correctly"
230 fi
231 echo "Testing deleting invalid WIM image (this should generate errors)"
232 if imagex delete dir.wim 4; then
233         error "Expected to fail to delete non-existent WIM image"
234 fi
235 if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 3; then
236         error "Image count changed even though we intentionally failed to delete an image"
237 fi
238 echo "Testing deleting all WIM images"
239 if ! imagex delete dir.wim all; then
240         error "Failed to delete all images from WIM"
241 fi
242 if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 0; then
243         error "Couldn't delete all WIM images correctly"
244 fi
245 echo "Testing appending directory to empty WIM and making it bootable"
246 if ! imagex append dir dir.wim "myname" "mydesc" --check --boot; then
247         error "Couldn't append named, described, bootable image to empty WIM with integrity check"
248 fi
249 if ! test "`imagex info dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
250         error "Integrity check not found"
251 fi
252 if ! test "`imagex info dir.wim | grep Boot | awk '{print $3}'`" = "1"; then
253         error "Bootable image not set correctly"
254 fi
255 echo "Testing appending non-directory (should generate errors)"
256 if imagex append dir.wim dir.wim; then
257         error "Incorrectly succeeded to append non-directory to WIM"
258 fi
259 echo "Testing appending non-existent file (should generate errors)"
260 if imagex append SOME_NONEXISTENT_FILE dir.wim; then
261         error "Incorrectly succeeded to append non-existent file to WIM"
262 fi
263 echo "Testing appending directory containing unreadable file (should generate errors)"
264 mkdir -p dir3
265 echo 1 > dir3/file
266 chmod -r dir3/file
267 if imagex append dir3 dir.wim; then
268         error "Incorrectly succeeded in capturing directory with unreadable file"
269 fi
270 rm -rf dir3 dir.wim
271
272 # Applying multiple images, applying with hardlinks/symlinks
273
274 echo "Testing application of multiple images"
275 if ! imagex capture dir dir.wim; then
276         error "Failed to prepare test WIM"
277 fi
278 if ! imagex append dir dir.wim "myname"; then
279         error "Failed to append image to test WIM"
280 fi
281 if ! imagex apply dir.wim all tmp; then
282         error "Applying multiple images failed"
283 fi
284 if ! diff -q -r tmp/dir tmp/myname || ! diff -q -r dir tmp/dir; then
285         error "Recursive diff of applied WIM with original directory failed"
286 fi
287 if test "`stat -c %h tmp/dir/lz.c`" != 1; then
288         error "Incorrect link count on extracted file"
289 fi
290 if test "`stat -c %h tmp/myname/lz.c`" != 1; then
291         error "Incorrect link count on extracted file"
292 fi
293 if test "`stat -c %i tmp/myname/lz.c`" = "`stat -c %i tmp/dir/lz.c`"; then
294         error "Incorrect inode number"
295 fi
296 rm -rf tmp
297 echo "Testing application of multiple images with hardlinks"
298 if ! imagex apply dir.wim all tmp --hardlink; then
299         error "Failed to apply multiple images with cross-image hardlinks"
300 fi
301 if ! diff -q -r tmp/dir tmp/myname || ! diff -q -r dir tmp/dir; then
302         error "Recursive diff of applied WIM with original directory failed"
303 fi
304 if test "`stat -c %h tmp/dir/lz.c`" != 2; then
305         error "Incorrect link count on extracted file"
306 fi
307 if test "`stat -c %h tmp/myname/lz.c`" != 2; then
308         error "Incorrect link count on extracted file"
309 fi
310 if test "`stat -c %i tmp/myname/lz.c`" != "`stat -c %i tmp/dir/lz.c`"; then
311         error "Incorrect inode number"
312 fi
313 rm -rf tmp
314
315 echo "Testing application of single image containing identical files"
316 if ! imagex apply dir.wim 1 tmp; then
317         error "Failed to apply WIM"
318 fi
319 if test "`stat -c %h tmp/subdir/hello`" != 2; then
320         error "Incorrect link count on extracted file"
321 fi
322 if test "`stat -c %h tmp/subdir/hello2`" != 1; then
323         error "Incorrect link count on extracted file"
324 fi
325 if test "`stat -c %i tmp/subdir/hello`" = "`stat -c %i tmp/subdir/hello2`"; then
326         error "Inode numbers on non-hard-linked files are the same"
327 fi
328 if test "`stat -c %i tmp/subdir/hello`" != "`stat -c %i tmp/subdir/hellolink`"; then
329         error "Inode numbers on hard-linked files are different"
330 fi
331 rm -rf tmp
332
333 echo "Testing application of single image containing identical files with hardlinks"
334 if ! imagex apply dir.wim 1 tmp --hardlink; then
335         error "Failed to apply WIM"
336 fi
337 if test "`stat -c %h tmp/subdir/hello`" != 3; then
338         error "Incorrect link count on extracted file"
339 fi
340 if test "`stat -c %h tmp/subdir/hello2`" != 3; then
341         error "Incorrect link count on extracted file"
342 fi
343 if test "`stat -c %i tmp/subdir/hello`" != "`stat -c %i tmp/subdir/hello2`"; then
344         error "Hard link set does not share inode number"
345 fi
346 if test "`stat -c %i tmp/subdir/hello`" != "`stat -c %i tmp/subdir/hellolink`"; then
347         error "Hard link set does not share inode number"
348 fi
349 rm -rf tmp
350
351 echo "Testing application of single image containing identical files with symlinks"
352 if ! imagex apply dir.wim 1 tmp --symlink; then
353         error "Failed to apply WIM"
354 fi
355 if test "`stat -c %h tmp/subdir/hello`" != 1; then
356         error "Incorrect link count on extracted file"
357 fi
358 if test "`stat -c %h tmp/subdir/hello2`" != 1; then
359         error "Incorrect link count on extracted file"
360 fi
361 if test "`stat -c %i tmp/subdir/hello`" = "`stat -c %i tmp/subdir/hello2`"; then
362         error "Incorrect inode number"
363 fi
364 if ! test -L tmp/subdir/hello || ! test -L tmp/subdir/hello2; then
365         error "Expected symlinks, but found non-symlinks"
366 fi
367 rm -rf dir.wim tmp
368
369 # imagex mount
370
371 for flag in "--compress=none" "--compress=maximum" "--compress=fast"; do
372         echo "Using flag $flag"
373         echo "Testing mounting WIM read-only"
374         if ! imagex capture dir dir.wim $flag; then
375                 error "Failed to capture WIM"
376         fi
377         mkdir tmp
378         if ! imagex mount dir.wim dir tmp; then
379                 error "Failde to mount test WIM read-only"
380         fi
381         echo "Testing extracting file from mounted read-only WIM"
382         if ! cp tmp/lz.c lz.c; then
383                 error "Failed to extract file from read-only mounted WIM"
384         fi
385         if ! diff -q dir/lz.c lz.c; then
386                 error "Extracted file does not match copy in mounted WIM"
387         fi
388         if ! diff -q tmp/lz.c dir/lz.c; then
389                 error "Extractef file does not match original"
390         fi
391         rm -f lz.c
392         echo "Testing modifying mounted read-only WIM (should fail)"
393         if rm tmp/lz.c; then
394                 error "Removing file from read-only mounted WIM didn't fail"
395         fi
396         if touch tmp/newfile; then
397                 error "Creating file on read-only mounted WIM didn't fail"
398         fi
399         if echo 3 > tmp/lz.c; then
400                 error "Writing to file on read-only mounted WIM didn't fail"
401         fi
402         echo "Testing diff of mounted read-only WIM with original directory"
403         if ! diff -q -r tmp dir; then
404                 error "Recursive diff of read-only mounted WIM with original directory failed"
405         fi
406         echo "Testing unmount of read-only filesystem"
407         if ! imagex unmount tmp; then
408                 error "Unmounting read-only WIM failed"
409         fi
410         echo "Testing unmount of read-only filesystem with --commit given"
411         if ! imagex mount dir.wim dir tmp; then
412                 error "Failed to re-mount WIM read-only"
413         fi
414         if ! imagex unmount tmp --commit; then
415                 error "Failed to unmount read-only WIM with --commit flag (should be ignored)"
416         fi
417         rm -rf tmp dir.wim
418 done
419
420 # imagex mountrw
421 echo "Testing mounting WIM read-write"
422 if ! imagex capture dir dir.wim; then
423         error "Failed to capture WIM"
424 fi
425 mkdir tmp
426 if ! imagex mountrw dir.wim dir tmp; then
427         error "Failed to mount test WIM read-write"
428 fi
429 echo "Testing unmounting WIM unmodified"
430 if ! imagex unmount tmp; then
431         error "Failed to unmount test WIM unmodified"
432 fi
433 echo "Testing unmounting WIM unmodified with --commit and --check"
434 if ! imagex mountrw dir.wim dir tmp; then
435         error "Failed to re-mount test WIM read-write"
436 fi
437 if ! imagex unmount tmp --commit --check; then
438         error "Failed to unmount read-write mounted WIM with changes commited (no changes made)"
439 fi
440 echo "Testing removing file from mounted WIM"
441 if ! imagex mountrw dir.wim dir tmp; then
442         error "Failed to re-mount test WIM read-write"
443 fi
444 if ! rm tmp/lz.c; then
445         error "Failed to remove file from read-write mounted WIM"
446 fi
447 if test -f tmp/lz.c; then
448         error "Removing file from read-write mounted WIM failed"
449 fi
450 echo "Testing making directory in mounted WIM"
451 if ! mkdir tmp/newdir; then
452         error "Failed to make directory in read-write mounted WIM"
453 fi
454 if ! test -d tmp/newdir; then
455         error "Making directory in read-write mounted WIM failed"
456 fi
457 echo "Testing making new empty file in mounted WIM"
458 if ! touch tmp/newdir/empty_file; then
459         error "Could not create new empty file in read-write mounted WIM"
460 fi
461 if ! test -f tmp/newdir/empty_file; then
462         error "New empty file not created correctly in read-write mounted WIM"
463 fi
464 if ! test "`stat -c %s tmp/newdir/empty_file`" = 0; then
465         error "New empty file in read-write mounted WIM is not empty"
466 fi
467 echo "Testing making new non-empty file in mounted WIM"
468 if ! dd if=/dev/zero of=tmp/newdir/zeroes1 bs=1 count=4096; then
469         error "Failed to make new non-empty file in mounted WIM"
470 fi
471 if ! dd if=/dev/zero of=tmp/newdir/zeroes2 bs=4096 count=1; then
472         error "Failed to make new non-empty file in mounted WIM"
473 fi
474 if ! diff -q tmp/newdir/zeroes1 tmp/newdir/zeroes2; then
475         error "New files in mounted WIM not made correctly"
476 fi
477 echo "Unmounting WIM with changes committed and --check"
478 if ! imagex unmount tmp --commit --check; then
479         error "Failed to unmount read-write mounted WIM"
480 fi
481 if test "`imagex info dir.wim | grep Integrity | awk '{print $3}'`" != "yes"; then
482         error "Integrity information was not included"
483 fi
484 rm -rf tmp
485 if ! imagex apply dir.wim tmp; then
486         error "Failed to apply WIM we had previously mounted read-write"
487 fi
488 if ! diff -q tmp/newdir/zeroes1 tmp/newdir/zeroes2; then
489         error "The new non-empty files we made in the read-write mounted WIM were not extracted correctly"
490 fi
491 if test `stat -c %s tmp/newdir/empty_file` != 0; then
492         error "The new empty file we made in the read-write mounted WIM was not extracted correctly"
493 fi
494 if test `stat -c %s tmp/newdir/zeroes1` != 4096; then
495         error "The new non-empty files we made in the read-write mounted WIM were not extracted correctly"
496 fi
497 rm -rf tmp dir.wim
498
499 # imagex split, imagex join
500
501 echo "Creating random files to test WIM splitting on"
502 mkdir tmp
503 for i in `seq 1 100`; do
504         dd if=/dev/urandom of=tmp/file$i bs=4096 count=10 &> /dev/null
505 done
506 for flag in "--compress=none" "--compress=maximum" "--compress=fast"; do
507         echo "Using flag $flag"
508         if ! imagex capture tmp tmp.wim $flag; then
509                 error "Failed to capture test WIM"
510         fi
511         echo "Splitting WIM into 1 MiB chunks"
512         if ! imagex split tmp.wim tmp.swm 1; then
513                 error "Failed to split WIM"
514         fi
515         echo "Verifying the split WIMs (some errors expected)"
516         if test "`imagex info tmp.swm | grep 'Part Number' | awk '{print $3}'`" != "1/4"; then
517                 error "Part number of split WIM not correct"
518         fi
519         if ! imagex dir tmp.swm > /dev/null; then
520                 error "Failed to list files in split WIM"
521         fi
522         if ! test -e tmp2.swm; then
523                 error "Could not find split-WIM part 2"
524         fi
525         if imagex dir tmp2.swm > /dev/null; then
526                 error "Listed files in part 2 of split WIM (this should have failed)"
527         fi
528
529         # Unsupported, should fail
530         if imagex info tmp.swm --boot 0; then
531                 error "Should not have been able to change boot index of split WIM"
532         fi
533         echo "Joining the split WIMs and applying the result"
534         if ! imagex join tmp2.wim tmp*.wim; then
535                 error "Failed to join split WIMs"
536         fi
537         if ! imagex apply tmp2.wim tmp2; then
538                 error "Failed to apply joined split WIM"
539         fi
540         if ! imagex apply tmp.wim tmp3; then
541                 error "Failed to apply test WIM"
542         fi
543         if ! diff -q -r tmp tmp2 || ! diff -q -r tmp tmp3; then
544                 error "Recursive diff of applied joined split WIM with original directory failed"
545         fi
546         rm -f *.wim *.swm
547         rm -rf tmp2 tmp3
548 done
549 rm -rf tmp
550
551 # imagex export
552 echo "Testing export of single image to new WIM"
553 if ! imagex capture dir dir.wim; then
554         error "Failed to capture test WIM"
555 fi
556 if ! imagex append dir2 dir.wim; then
557         error "Failed to append image to test WIM"
558 fi
559 if ! imagex export dir.wim dir new.wim; then
560         error "Failed to export single image to new WIM"
561 fi
562 if test "`imagex info new.wim | grep 'Image Count' | awk '{print $3}'`" != 1; then
563         error "Exporting single image to new WIM wasn't done correctly"
564 fi
565 echo "Testing export of single image to existing WIM"
566 if ! imagex export dir.wim dir2 new.wim; then
567         error "Failed to export single image to existing WIM"
568 fi
569 if test "`imagex info new.wim | grep 'Image Count' | awk '{print $3}'`" != 2; then
570         error "Exporting single image to existing WIM wasn't done correctly"
571 fi
572 echo "Testing export of single image to existing WIM using wrong compression type"
573 if imagex export dir.wim dir2 new.wim newname --compress=maximum; then
574         error "Successfully exported image using wrong compression type"
575 fi
576 rm -f new.wim
577 echo "Testing export of multiple images to new WIM"
578 if ! imagex export dir.wim all new.wim; then
579         error "Failed to export multiple images to new WIM"
580 fi
581 if test "`imagex info new.wim | grep 'Image Count' | awk '{print $3}'`" != 2; then
582         error "Exporting multiple images to new WIM wasn't done correctly"
583 fi
584 if ! imagex capture dir2 new.wim newname; then
585         error "Failed to capture test WIM"
586 fi
587 echo "Testing export of multiple images to existing WIM"
588 if ! imagex export dir.wim all new.wim; then
589         error "Failed to export multiple images to existing WIM"
590 fi
591 echo "Testing export of multiple images to existing WIM with --boot"
592 if ! imagex capture dir2 new.wim newname; then
593         error "Failed to capture test WIM"
594 fi
595 if ! imagex info dir.wim --boot 1; then
596         error "Failed to set boot index on test WIM"
597 fi
598 if ! imagex export dir.wim all new.wim --boot; then
599         error "Failed to export multiple images to existing WIM with bootable image"
600 fi
601 echo "Testing export of multiple images to existing WIM with --boot, but no bootable image (errors expected)"
602 if ! imagex capture dir2 new.wim newname; then
603         error "Failed to capture test WIM"
604 fi
605 if ! imagex info dir.wim --boot 0; then
606         error "Failed to clear boot index on test WIM"
607 fi
608 if imagex export dir.wim all new.wim --boot; then
609         error "Successfully exported multiple images with --boot but with no bootable images"
610 fi
611
612 echo "**********************************************************"
613 echo "                     All tests passed                     "
614 echo "**********************************************************"