]> wimlib.net Git - wimlib/blobdiff - tests/test-imagex
README.WINDOWS: fix category of p7zip
[wimlib] / tests / test-imagex
index 78a08182f19f0efdad95420c8e57b438010abaa7..9c92715b1fca95a100939f7066088a632e535bf4 100755 (executable)
@@ -7,7 +7,7 @@ set -e
 cd tests
 srcdir="${srcdir:-.}/.."
 srcdir="$(cd $srcdir; pwd)"
-. "$srcdir/tests/tests-common.sh"
+. "$srcdir/tests/test_utils.sh"
 
 TEST_SUBDIR=tmpdir_test-imagex
 
@@ -65,6 +65,21 @@ for comp_type in None LZX XPRESS; do
        rm -rf dir.wim tmp
 done
 
+# Test wimappend --create
+rm -f dir.wim
+if wimappend dir dir.wim; then
+       error "wimappend to nonexisting file unexpectedly succeeded"
+fi
+if ! wimappend dir dir.wim --create; then
+       error "wimappend --create to nonexisting file failed"
+fi
+if ! wimappend dir dir.wim --create; then
+       error "wimappend --create to existing file failed"
+fi
+if ! test "`wiminfo dir.wim | grep 'Image Count' | awk '{print $3}'`" = 2; then
+       error "Incorrect WIM image count after wimappend --create"
+fi
+
 # Capturing and modifying name, description, and bootable flag
 
 echo "Testing capture of WIM with default name and description"
@@ -152,7 +167,7 @@ echo "Testing capture of WIM with integrity table"
 if ! wimcapture dir dir.wim --check; then
        error "Failed to capture WIM with integrity table"
 fi
-if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
+if ! wiminfo dir.wim | grep -q Integrity; then
        error "Integrity table on WIM not made"
 fi
 if ! wimapply --check dir.wim tmp; then
@@ -186,14 +201,14 @@ echo "Testing appending WIM image with integrity check"
 if ! wimappend dir2 dir.wim "newname2" --check; then
        error "Appending WIM image failed"
 fi
-if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
+if ! wiminfo dir.wim | grep -q Integrity; then
        error "Integrity table not set correctly on image append"
 fi
 echo "Testing appending WIM image with no integrity check"
 if ! wimappend dir2 dir.wim "newname3" --nocheck; then
        error "Appending WIM image failed"
 fi
-if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "no"; then
+if wiminfo dir.wim | grep -q Integrity; then
        error "WIM integrity table not removed"
 fi
 # 5 images at this point
@@ -232,7 +247,7 @@ echo "Testing appending directory to empty WIM and making it bootable"
 if ! wimappend dir dir.wim "myname" "mydesc" --check --boot; then
        error "Couldn't append named, described, bootable image to empty WIM with integrity check"
 fi
-if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
+if ! wiminfo dir.wim | grep -q Integrity; then
        error "Integrity check not found"
 fi
 if ! test "`wiminfo dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "1"; then