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