cd tests
srcdir="${srcdir:-.}/.."
srcdir="$(cd $srcdir; pwd)"
-. "$srcdir/tests/tests-common.sh"
+. "$srcdir/tests/test_utils.sh"
TEST_SUBDIR=tmpdir_test-imagex
rm -rf dir.wim tmp
done
+# Test wimverify and the SHA-1 code
+WIMLIB_DISABLE_CPU_FEATURES='*' wimcapture dir dir.wim --compress=none
+disabled=''
+for cpu_feature in '' sha1 bmi2 avx sse4.2 sse4.1 ssse3; do
+ [ -n "$disabled" ] && disabled+=','
+ disabled+="$cpu_feature"
+ if ! WIMLIB_DISABLE_CPU_FEATURES=$disabled wimverify dir.wim; then
+ error "wimverify failed (cpu_features_disabled=$disabled)"
+ fi
+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"
fi
rm -rf dir.wim tmp
+name_desc_test() {
+ local name=$1
+ local desc=$2
+ if ! wimcapture dir dir.wim "$name" "$desc"; then
+ error "Failed to capture WIM with specified name and description"
+ fi
+ if ! test "`wiminfo dir.wim | grep Name | awk '{print $2}'`" = "$name"; then
+ error "WIM name not set correctly"
+ fi
+ if ! test "`wiminfo dir.wim | grep Description | awk '{print $2}'`" = "$desc"; then
+ error "WIM description not set correctly"
+ fi
+}
+
echo "Testing capture of WIM with name and description"
-if ! wimcapture dir dir.wim "myname" "mydesc"; then
- error "Failed to capture WIM with specified name and description"
-fi
-if ! test "`wiminfo dir.wim | grep Name | awk '{print $2}'`" = "myname"; then
- error "WIM name not set correctly"
-fi
-if ! test "`wiminfo dir.wim | grep Description | awk '{print $2}'`" = "mydesc"; then
- error "WIM name not set correctly"
-fi
+name_desc_test "myname" "mydesc"
+
+echo "Testing capture of WIM with non-ASCII name and description"
+name_desc_test "áéíóú" "¿?"
+
echo "Testing printing WIM lookup table"
if ! wiminfo --lookup-table dir.wim > /dev/null; then
error "Failed to print WIM lookup 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
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
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