X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=tests%2Ftest-imagex-capture_and_apply;h=105d0f3955bc22d4be247a47786a8454bf68dd05;hp=ce54c74acb12748da84b364c6bfe0b0d7e680387;hb=47898041237677686c46ccac6dd88485a63ddf93;hpb=df7f6ca9f3d34b5133667ad35f800b7afcabe434 diff --git a/tests/test-imagex-capture_and_apply b/tests/test-imagex-capture_and_apply index ce54c74a..105d0f39 100755 --- a/tests/test-imagex-capture_and_apply +++ b/tests/test-imagex-capture_and_apply @@ -53,7 +53,10 @@ do_test() { # Can we split the WIM, apply the split WIM, join the split WIM, # and apply the joined WIM, and get the same results every time? - if ! imagex split test.wim test.swm 0.01; then + # + # LC_ALL=C avoids locale-dependent floating point number + # parsing. + if ! LC_ALL=C imagex split test.wim test.swm 0.01; then error "Failed to split WIM" fi if ! imagex apply test.swm 1 out.dir --ref "test*.swm" ; then @@ -81,6 +84,41 @@ do_test() { error "Failed to apply exported WIM image" fi do_tree_cmp + rm -rf out.dir/* + + # Try pipable WIM (don't bother testing all compression types + # though, it shouldn't make a difference). + if [ "$ctype" = "None" ]; then + # Capture pipable WIM (not writing to pipe) + if ! imagex capture in.dir test.wim \ + --compress=$ctype --norpfix --pipable; then + error "Failed to capture directory tree into a pipable WIM" + fi + + # Apply pipable WIM (reading from pipe) + if ! cat test.wim | imagex apply - 1 out.dir; then + error "Failed to apply pipable WIM to directory (from pipe)" + fi + do_tree_cmp + rm -rf out.dir/* + + # Apply pipable WIM (not reading from pipe) + if ! imagex apply test.wim 1 out.dir; then + error "Failed to apply pipable WIM to directory (not from pipe)" + fi + do_tree_cmp + rm -rf out.dir/* + + # Capture pipable WIM (writing to pipe) and read pipable + # WIM (reading from pipe) + if ! imagex_raw capture --pipable --compress=$ctype \ + --norpfix --pipable \ + in.dir - | imagex apply - 1 out.dir; then + error "Failed to capture directory tree into a pipable WIM" + fi + do_tree_cmp + rm -rf out.dir/* + fi rm -rf out.dir/* in.dir/* test.wim test*.swm @@ -114,6 +152,7 @@ if [ -e out.dir/hiberfil.sys -o -e "out.dir/System Volume Information" ]; then error "Files were not excluded from capture as expected" fi +# Make sure reparse point fixups are working as expected __msg "Testing --rpfix" rm -r in.dir out.dir mkdir in.dir @@ -151,6 +190,78 @@ then error "imagex apply failed to apply fixed absolute symlinks" fi +# Make sure source list mode is working as expected +__msg "Testing source list capture mode" +rm -rf in.dir out.dir +mkdir in.dir +echo 1 > in.dir/1 +ln in.dir/1 in.dir/1link +echo 5 > 5 +mkdir otherdir +cp $srcdir/src/add_image.c otherdir +cat > srclist << EOF +in.dir / +5 /5 +otherdir /otherdir +EOF +imagex capture srclist --source-list test.wim +imagex apply test.wim out.dir +if [[ ! -f out.dir/5 || ! -f out.dir/1 || ! -f out.dir/1link || \ + ! -d out.dir/otherdir ]]; then + error "source list capture failed to work as expected" +fi + +# Still testing source list capture: add quoted name, and try overlay +rm -rf out.dir +cat > srclist << EOF +in.dir / +5 /5 +otherdir /otherdir + "overlay dir 1" 'otherdir' + "overlay dir 2" 'otherdir' +EOF +mkdir "overlay dir 1" +mkdir "overlay dir 2" +echo A > "overlay dir 1"/A +echo B > "overlay dir 2"/B +imagex capture srclist --source-list test.wim +imagex apply test.wim out.dir +if [[ ! -f out.dir/5 || ! -f out.dir/1 || ! -f out.dir/1link || \ + ! -f out.dir/otherdir/A || ! -f out.dir/otherdir/B ]]; then + error "source list capture (with quoted names and basic overlay) failed to work as expected" +fi + +# Try deep overlay +rm -rf in.dir out.dir "overlay dir 1" "overlay dir 2" +mkdir -p in.dir.1/subdir/subdir2 in.dir.2/subdir/subdir2 +cat > srclist << EOF +in.dir.1 / +in.dir.2 / +EOF +echo 1 > in.dir.1/subdir/1 +echo 2 > in.dir.2/subdir/2 +echo 3 > in.dir.1/subdir/subdir2/3 +echo 4 > in.dir.2/subdir/subdir2/4 +imagex capture srclist --source-list test.wim +imagex apply test.wim out.dir +if [[ ! -f out.dir/subdir/1 || ! -f out.dir/subdir/2 || \ + ! -f out.dir/subdir/subdir2/3 || ! -f out.dir/subdir/subdir2/4 ]]; then + error "source list capture (with deep overlay) failed to work as expected" +fi + +# Try bad overlay +__msg "Testing bad overlay (errors expected)" +rm -rf out.dir +echo 5 > 5 +cat > srclist << EOF +in.dir.1 / +in.dir.2 / +5 /subdir +EOF +if imagex capture srclist --source-list test.wim; then + error "unexpected success in bad overlay with --source-list!" +fi + echo "**********************************************************" echo " imagex capture/apply tests passed " echo "**********************************************************"