#!/usr/bin/env bash
-# This script does some sanity testing of the 'imagex' program. It by no means
-# tests every aspect of wimlib comprehensively.
+# This script does some sanity testing of the 'wimlib-imagex' program. It by no
+# means tests every aspect of wimlib comprehensively.
set -e
cd tests
for comp_type in None LZX XPRESS; do
echo "Testing capture and application of $comp_type-compressed WIM"
- if ! imagex capture dir dir.wim --compress=$comp_type; then
- error "'imagex capture' failed"
+ if ! wimcapture dir dir.wim --compress=$comp_type; then
+ error "'wimcapture' failed"
fi
- if ! imagex apply dir.wim tmp; then
- error "'imagex apply' failed"
+ if ! wimapply dir.wim tmp; then
+ error "'wimapply' failed"
fi
if ! test `wim_ctype dir.wim` = "$comp_type"; then
- error "'imagex info' didn't report the compression type correctly"
+ error "'wiminfo' didn't report the compression type correctly"
fi
if ! diff -q -r dir tmp; then
error "Recursive diff of extracted directory with original failed"
# Capturing and modifying name, description, and bootable flag
echo "Testing capture of WIM with default name and description"
-imagex capture dir dir.wim
-if ! test "`imagex info dir.wim | grep Name | awk '{print $2}'`" = "dir"; then
+wimcapture dir dir.wim
+if ! test "`wiminfo dir.wim | grep Name | awk '{print $2}'`" = "dir"; then
error "WIM name not set correctly"
fi
-if ! test "`imagex info dir.wim | grep Description | awk '{print $2}'`" = ""; then
+if ! test "`wiminfo dir.wim | grep Description | awk '{print $2}'`" = ""; then
error "WIM description not set correctly"
fi
echo "Testing capture of WIM with default boot flag"
-imagex capture dir dir.wim
-if ! test "`imagex info dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "0"; then
+wimcapture dir dir.wim
+if ! test "`wiminfo dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "0"; then
error "WIM boot flag not set correctly"
fi
echo "Testing changing image bootable flag"
-if ! imagex info dir.wim 1 --boot; then
+if ! wiminfo dir.wim 1 --boot; then
error "Failed to change bootable image"
fi
-if ! test "`imagex info dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "1"; then
+if ! test "`wiminfo dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "1"; then
error "Bootable image not changed correctly"
fi
echo "Testing changing image bootable flag"
-if ! imagex info dir.wim 0 --boot; then
+if ! wiminfo dir.wim 0 --boot; then
error "Failed to reset bootable image"
fi
-if ! test "`imagex info dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "0"; then
+if ! test "`wiminfo dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "0"; then
error "Bootable image not reset correctly"
fi
echo "Testing changing image bootable flag to invalid image (this should generate errors)"
-if imagex info dir.wim 2 --boot; then
+if wiminfo dir.wim 2 --boot; then
error "Succeeded in changing bootable image to invalid number"
fi
-if ! test "`imagex info dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "0"; then
+if ! test "`wiminfo dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "0"; then
error "Boot flag was changed even though the change command was supposed to fail"
fi
rm -rf dir.wim tmp
echo "Testing capture of WIM with name and description"
-if ! imagex capture dir dir.wim "myname" "mydesc"; then
+if ! wimcapture dir dir.wim "myname" "mydesc"; then
error "Failed to capture WIM with specified name and description"
fi
-if ! test "`imagex info dir.wim | grep Name | awk '{print $2}'`" = "myname"; then
+if ! test "`wiminfo dir.wim | grep Name | awk '{print $2}'`" = "myname"; then
error "WIM name not set correctly"
fi
-if ! test "`imagex info dir.wim | grep Description | awk '{print $2}'`" = "mydesc"; then
+if ! test "`wiminfo dir.wim | grep Description | awk '{print $2}'`" = "mydesc"; then
error "WIM name not set correctly"
fi
echo "Testing printing WIM lookup table"
-if ! imagex info --lookup-table dir.wim > /dev/null; then
+if ! wiminfo --lookup-table dir.wim > /dev/null; then
error "Failed to print WIM lookup table"
fi
echo "Testing printing WIM header"
-if ! imagex info --header dir.wim > /dev/null; then
+if ! wiminfo --header dir.wim > /dev/null; then
error "Failed to print WIM header"
fi
echo "Testing printing WIM XML info"
-if ! imagex info --xml dir.wim > /dev/null; then
+if ! wiminfo --xml dir.wim > /dev/null; then
error "Failed to print WIM XML data"
fi
echo "Testing extracting WIM XML info"
-if ! imagex info --extract-xml=dir.xml dir.wim; then
+if ! wiminfo --extract-xml=dir.xml dir.wim; then
error "Failed to extract WIM XML data"
fi
echo "Testing printing WIM metadata"
-if ! imagex dir --detailed dir.wim > /dev/null; then
+if ! wimdir --detailed dir.wim > /dev/null; then
error "Failed to print WIM metadata"
fi
rm -rf dir.wim tmp dir.xml
echo "Testing capture of bootable WIM"
-if ! imagex capture dir dir.wim --boot; then
+if ! wimcapture dir dir.wim --boot; then
error "Failed to capture bootable WIM"
fi
-if ! test "`imagex info dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "1"; then
+if ! test "`wiminfo dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "1"; then
error "Boot flag on bootable WIM not set correctly"
fi
rm -rf dir.wim tmp
# Integrity table
echo "Testing capture of WIM with integrity table"
-if ! imagex capture dir dir.wim --check; then
+if ! wimcapture dir dir.wim --check; then
error "Failed to capture WIM with integrity table"
fi
-if ! test "`imagex info dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
+if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
error "Integrity table on WIM not made"
fi
-if ! imagex apply --check dir.wim tmp; then
+if ! wimapply --check dir.wim tmp; then
error "Integrity table on WIM not made correctly"
fi
if ! diff -q -r dir tmp; then
# Appending and deleting images
echo "Testing appending WIM image"
-imagex capture dir dir.wim
-if ! imagex append dir2 dir.wim; then
+wimcapture dir dir.wim
+if ! wimappend dir2 dir.wim; then
error "Appending WIM image failed"
fi
-if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 2; then
+if ! test "`wiminfo dir.wim | grep 'Image Count' | awk '{print $3}'`" = 2; then
error "WIM image count not correct"
fi
echo "Testing appending WIM image with existing name (this should generate errors)"
-if imagex append dir2 dir.wim "dir"; then
+if wimappend dir2 dir.wim "dir"; then
error "Adding duplicate image name didn't fail"
fi
echo "Testing appending WIM image with new name"
-if ! imagex append dir2 dir.wim "newname"; then
+if ! wimappend dir2 dir.wim "newname"; then
error "Appending WIM image failed"
fi
echo "Testing appending WIM image with integrity check"
-if ! imagex append dir2 dir.wim "newname2" --check; then
+if ! wimappend dir2 dir.wim "newname2" --check; then
error "Appending WIM image failed"
fi
-if ! test "`imagex info dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
+if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
error "Integrity table not set correctly on image append"
fi
echo "Testing appending WIM image with no integrity check"
-if ! imagex append dir2 dir.wim "newname3" --nocheck; then
+if ! wimappend dir2 dir.wim "newname3" --nocheck; then
error "Appending WIM image failed"
fi
-if ! test "`imagex info dir.wim | grep Integrity | awk '{print $3}'`" = "no"; then
+if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "no"; then
error "WIM integrity table not removed"
fi
# 5 images at this point
-if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 5; then
+if ! test "`wiminfo dir.wim | grep 'Image Count' | awk '{print $3}'`" = 5; then
error "WIM does not contain the expected 5 images"
fi
echo "Testing deleting first WIM image"
-if ! imagex delete dir.wim 1; then
+if ! wimdelete dir.wim 1; then
error "Failed to delete WIM image"
fi
-if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 4; then
+if ! test "`wiminfo dir.wim | grep 'Image Count' | awk '{print $3}'`" = 4; then
error "WIM image not deleted correctly"
fi
echo "Testing deleting last WIM image"
-if ! imagex delete dir.wim 4; then
+if ! wimdelete dir.wim 4; then
error "Failed to delete WIM image"
fi
-if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 3; then
+if ! test "`wiminfo dir.wim | grep 'Image Count' | awk '{print $3}'`" = 3; then
error "WIM image not deleted correctly"
fi
echo "Testing deleting invalid WIM image (this should generate errors)"
-if imagex delete dir.wim 4; then
+if wimdelete dir.wim 4; then
error "Expected to fail to delete non-existent WIM image"
fi
-if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 3; then
+if ! test "`wiminfo dir.wim | grep 'Image Count' | awk '{print $3}'`" = 3; then
error "Image count changed even though we intentionally failed to delete an image"
fi
echo "Testing deleting all WIM images"
-if ! imagex delete dir.wim all; then
+if ! wimdelete dir.wim all; then
error "Failed to delete all images from WIM"
fi
-if ! test "`imagex info dir.wim | grep 'Image Count' | awk '{print $3}'`" = 0; then
+if ! test "`wiminfo dir.wim | grep 'Image Count' | awk '{print $3}'`" = 0; then
error "Couldn't delete all WIM images correctly"
fi
echo "Testing appending directory to empty WIM and making it bootable"
-if ! imagex append dir dir.wim "myname" "mydesc" --check --boot; then
+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 "`imagex info dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
+if ! test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" = "yes"; then
error "Integrity check not found"
fi
-if ! test "`imagex info dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "1"; then
+if ! test "`wiminfo dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "1"; then
error "Bootable image not set correctly"
fi
echo "Testing appending non-directory (should generate errors)"
-if imagex append dir.wim dir.wim; then
+if wimappend dir.wim dir.wim; then
error "Incorrectly succeeded to append non-directory to WIM"
fi
echo "Testing appending non-existent file (should generate errors)"
-if imagex append SOME_NONEXISTENT_FILE dir.wim; then
+if wimappend SOME_NONEXISTENT_FILE dir.wim; then
error "Incorrectly succeeded to append non-existent file to WIM"
fi
if [ `id -u` != 0 ]; then
mkdir -p dir3
echo 1 > dir3/file
chmod -r dir3/file
- if imagex append dir3 dir.wim; then
+ if wimappend dir3 dir.wim; then
error "Incorrectly succeeded in capturing directory with unreadable file"
fi
fi
# Applying multiple images, applying with hardlinks/symlinks
echo "Testing application of multiple images"
-if ! imagex capture dir dir.wim; then
+if ! wimcapture dir dir.wim; then
error "Failed to prepare test WIM"
fi
-if ! imagex append dir dir.wim "myname"; then
+if ! wimappend dir dir.wim "myname"; then
error "Failed to append image to test WIM"
fi
-if ! imagex apply dir.wim all tmp; then
+if ! wimapply dir.wim all tmp; then
error "Applying multiple images failed"
fi
if ! diff -q -r tmp/dir tmp/myname || ! diff -q -r dir tmp/dir; then
rm -rf tmp
echo "Testing application of single image containing identical files"
-if ! imagex apply dir.wim 1 tmp; then
+if ! wimapply dir.wim 1 tmp; then
error "Failed to apply WIM"
fi
if test "`get_link_count tmp/subdir/hello`" != 2; then
fi
rm -rf tmp
-# imagex split, imagex join
+# wimsplit, wimjoin
echo "Creating random files to test WIM splitting on"
mkdir tmp
done
for flag in "--compress=none" "--compress=maximum" "--compress=fast"; do
echo "Using flag $flag"
- if ! imagex capture tmp tmp.wim $flag; then
+ if ! wimcapture tmp tmp.wim $flag; then
error "Failed to capture test WIM"
fi
echo "Splitting WIM into 1 MiB chunks"
- if ! imagex split tmp.wim tmp.swm 1; then
+ if ! wimsplit tmp.wim tmp.swm 1; then
error "Failed to split WIM"
fi
echo "Verifying the split WIMs (some errors expected)"
- if test "`imagex info tmp.swm | grep 'Part Number' | awk '{print $3}'`" != "1/4"; then
+ if test "`wiminfo tmp.swm | grep 'Part Number' | awk '{print $3}'`" != "1/4"; then
error "Part number of split WIM not correct"
fi
- if ! imagex dir tmp.swm > /dev/null; then
+ if ! wimdir tmp.swm > /dev/null; then
error "Failed to list files in split WIM"
fi
if ! test -e tmp2.swm; then
error "Could not find split-WIM part 2"
fi
- if imagex dir tmp2.swm > /dev/null; then
+ if wimdir tmp2.swm > /dev/null; then
error "Listed files in part 2 of split WIM (this should have failed)"
fi
# Unsupported, should fail
- if imagex info tmp.swm --boot 1; then
+ if wiminfo tmp.swm --boot 1; then
error "Should not have been able to change boot index of split WIM"
fi
echo "Joining the split WIMs and applying the result"
- if ! imagex join tmp2.wim tmp*.wim; then
+ if ! wimjoin tmp2.wim tmp*.wim; then
error "Failed to join split WIMs"
fi
- if ! imagex apply tmp2.wim tmp2; then
+ if ! wimapply tmp2.wim tmp2; then
error "Failed to apply joined split WIM"
fi
- if ! imagex apply tmp.wim tmp3; then
+ if ! wimapply tmp.wim tmp3; then
error "Failed to apply test WIM"
fi
if ! diff -q -r tmp tmp2 || ! diff -q -r tmp tmp3; then
done
rm -rf tmp
-# imagex export
+# wimexport
echo "Testing export of single image to new WIM"
-if ! imagex capture dir dir.wim; then
+if ! wimcapture dir dir.wim; then
error "Failed to capture test WIM"
fi
-if ! imagex append dir2 dir.wim; then
+if ! wimappend dir2 dir.wim; then
error "Failed to append image to test WIM"
fi
-if ! imagex export dir.wim dir new.wim; then
+if ! wimexport dir.wim dir new.wim; then
error "Failed to export single image to new WIM"
fi
-if test "`imagex info new.wim | grep 'Image Count' | awk '{print $3}'`" != 1; then
+if test "`wiminfo new.wim | grep 'Image Count' | awk '{print $3}'`" != 1; then
error "Exporting single image to new WIM wasn't done correctly"
fi
echo "Testing export of single image to existing WIM"
-if ! imagex export dir.wim dir2 new.wim; then
+if ! wimexport dir.wim dir2 new.wim; then
error "Failed to export single image to existing WIM"
fi
-if test "`imagex info new.wim | grep 'Image Count' | awk '{print $3}'`" != 2; then
+if test "`wiminfo new.wim | grep 'Image Count' | awk '{print $3}'`" != 2; then
error "Exporting single image to existing WIM wasn't done correctly"
fi
echo "Testing export of single image to existing WIM using wrong compression type"
-if imagex export dir.wim dir2 new.wim newname --compress=xpress; then
+if wimexport dir.wim dir2 new.wim newname --compress=xpress; then
error "Successfully exported image using wrong compression type"
fi
rm -f new.wim
echo "Testing export of multiple images to new WIM"
-if ! imagex export dir.wim all new.wim; then
+if ! wimexport dir.wim all new.wim; then
error "Failed to export multiple images to new WIM"
fi
-if test "`imagex info new.wim | grep 'Image Count' | awk '{print $3}'`" != 2; then
+if test "`wiminfo new.wim | grep 'Image Count' | awk '{print $3}'`" != 2; then
error "Exporting multiple images to new WIM wasn't done correctly"
fi
-if ! imagex capture dir2 new.wim newname; then
+if ! wimcapture dir2 new.wim newname; then
error "Failed to capture test WIM"
fi
echo "Testing export of multiple images to existing WIM"
-if ! imagex export dir.wim all new.wim; then
+if ! wimexport dir.wim all new.wim; then
error "Failed to export multiple images to existing WIM"
fi
echo "Testing export of multiple images to existing WIM with --boot"
-if ! imagex capture dir2 new.wim newname; then
+if ! wimcapture dir2 new.wim newname; then
error "Failed to capture test WIM"
fi
-if ! imagex info dir.wim --boot 1; then
+if ! wiminfo dir.wim --boot 1; then
error "Failed to set boot index on test WIM"
fi
-if ! imagex export dir.wim all new.wim --boot; then
+if ! wimexport dir.wim all new.wim --boot; then
error "Failed to export multiple images to existing WIM with bootable image"
fi
echo "Testing export of multiple images to existing WIM with --boot, but no bootable image (errors expected)"
-if ! imagex capture dir2 new.wim newname; then
+if ! wimcapture dir2 new.wim newname; then
error "Failed to capture test WIM"
fi
-if ! imagex info dir.wim --boot 0; then
+if ! wiminfo dir.wim --boot 0; then
error "Failed to clear boot index on test WIM"
fi
-if imagex export dir.wim all new.wim --boot; then
+if wimexport dir.wim all new.wim --boot; then
error "Successfully exported multiple images with --boot but with no bootable images"
fi
esac
echo "Testing exporting then applying an image (\"$cflag1\" => \"$cflag2\")"
rm -rf dir.wim new.wim tmp tmp2
- imagex capture dir dir.wim $cflag1
- imagex capture dir2 dir2.wim $cflag2
- imagex export dir.wim dir dir2.wim
- imagex apply dir.wim dir tmp
- if ! imagex apply dir2.wim dir tmp2; then
+ wimcapture dir dir.wim $cflag1
+ wimcapture dir2 dir2.wim $cflag2
+ wimexport dir.wim dir dir2.wim
+ wimapply dir.wim dir tmp
+ if ! wimapply dir2.wim dir tmp2; then
error "Failed to apply image that was exported to a WIM"
fi
if ! diff -r tmp tmp2; then
done
echo "**********************************************************"
-echo " Basic imagex tests passed "
+echo " Basic wimlib-imagex tests passed "
echo "**********************************************************"
# Leave test subdirectory and cleanup
if [ -x /usr/bin/tree -a "$ctype" = "None" ]; then
tree in.dir --inodes -F -s --noreport
fi
- if ! imagex capture in.dir test.wim --compress=$ctype --norpfix; then
+ if ! wimcapture in.dir test.wim --compress=$ctype --norpfix; then
error "Failed to capture directory tree into a WIM"
fi
- if ! imagex apply test.wim 1 out.dir; then
+ if ! wimapply test.wim 1 out.dir; then
error "Failed to apply WIM to directory"
fi
if [ `wim_ctype test.wim` != $ctype ]; then
- error "'imagex info' didn't report the compression type on the captured WIM correctly"
+ error "'wiminfo' didn't report the compression type on the captured WIM correctly"
fi
do_tree_cmp
rm -rf out.dir/*
#
# LC_ALL=C avoids locale-dependent floating point number
# parsing.
- if ! LC_ALL=C imagex split test.wim test.swm 0.01; then
+ if ! LC_ALL=C wimsplit 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
+ if ! wimapply test.swm 1 out.dir --ref "test*.swm" ; then
error "Failed to apply split WIM"
fi
do_tree_cmp
rm -rf out.dir/* test.wim
- if ! imagex join test.wim test*.swm; then
+ if ! wimjoin test.wim test*.swm; then
error "Failed to join split WIM"
fi
- if ! imagex apply test.wim out.dir; then
+ if ! wimapply test.wim out.dir; then
error "Failed to apply joined WIM"
fi
do_tree_cmp
# Can we export the image to another WIM, apply it, and get the
# same results?
(( image_name++ )) || true
- if ! imagex export test.wim 1 test2.wim "$image_name"; then
+ if ! wimexport test.wim 1 test2.wim "$image_name"; then
error "Failed to export WIM image"
fi
- if ! imagex apply test2.wim "$image_name" out.dir; then
+ if ! wimapply test2.wim "$image_name" out.dir; then
error "Failed to apply exported WIM image"
fi
do_tree_cmp
# 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 \
+ if ! wimcapture 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
+ if ! cat test.wim | wimapply - 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
+ if ! wimapply test.wim 1 out.dir; then
error "Failed to apply pipable WIM to directory (not from pipe)"
fi
do_tree_cmp
# Capture pipable WIM (writing to pipe) and read pipable
# WIM (reading from pipe)
- if ! imagex_raw capture --pipable --compress=$ctype \
+ if ! wimlib_imagex capture --pipable --compress=$ctype \
--norpfix --pipable \
- in.dir - | imagex apply - 1 out.dir; then
+ in.dir - | wimapply - 1 out.dir; then
error "Failed to capture directory tree into a pipable WIM"
fi
do_tree_cmp
__msg "Testing default capture configuration file"
touch in.dir/hiberfil.sys
mkdir -p "in.dir/System Volume Information/subdir"
-imagex capture in.dir test.wim
-imagex apply test.wim out.dir
+wimcapture in.dir test.wim
+wimapply test.wim out.dir
if [ -e out.dir/hiberfil.sys -o -e "out.dir/System Volume Information" ]; then
error "Files were not excluded from capture as expected"
fi
ln -s file in.dir/relalink
ln -s $PWD/in.dir/file in.dir/abslink
ln -s $PWD/in.dir/file/// in.dir/abslinkslashes
-imagex capture --rpfix in.dir test.wim
-imagex apply --norpfix test.wim out.dir
+wimcapture --rpfix in.dir test.wim
+wimapply --norpfix test.wim out.dir
if [[ `readlink out.dir/absrootlink` != "/" ]] ||
[[ `readlink out.dir/absrootlinkslashes` != "////" ]]; then
- error "imagex capture --rpfix failed to fix absolute link to capture root"
+ error "wimcapture --rpfix failed to fix absolute link to capture root"
fi
if [[ ! -L out.dir/absnonexistent ]] ||
[[ ! -L out.dir/absoutoftree ]]; then
- error "imagex capture --rpfix failed to also capture out of tree absolute links"
+ error "wimcapture --rpfix failed to also capture out of tree absolute links"
fi
if [[ `readlink out.dir/relalink` != "file" ]]; then
- error "imagex capture --rpfix failed to capture relative symlink"
+ error "wimcapture --rpfix failed to capture relative symlink"
fi
if [[ `readlink out.dir/abslink` != "/file" ]] ||
[[ `readlink out.dir/abslinkslashes` != "/file///" ]]; then
- error "imagex capture --rpfix did fix absolute link properly"
+ error "wimcapture --rpfix did fix absolute link properly"
fi
rm -rf out.dir
-imagex apply test.wim out.dir
+wimapply test.wim out.dir
if [[ $(get_inode_number $(readlink out.dir/absrootlink)) != \
$(get_inode_number out.dir) ]];
then
- error "imagex apply failed to apply fixed absolute symlinks"
+ error "wimapply failed to apply fixed absolute symlinks"
fi
# Make sure source list mode is working as expected
5 /5
otherdir /otherdir
EOF
-imagex capture srclist --source-list test.wim
-imagex apply test.wim out.dir
+wimcapture srclist --source-list test.wim
+wimapply 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"
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
+wimcapture srclist --source-list test.wim
+wimapply 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"
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
+wimcapture srclist --source-list test.wim
+wimapply 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"
in.dir.2 /
5 /subdir
EOF
-if imagex capture srclist --source-list test.wim; then
+if wimcapture srclist --source-list test.wim; then
error "unexpected success in bad overlay with --source-list!"
fi
echo "**********************************************************"
-echo " imagex capture/apply tests passed "
+echo " wimcapture/apply tests passed "
echo "**********************************************************"
cd ..
# "gvfs-gdu-volume-monitor" that apparently likes to randomly read
# filesystems that get mounted, thereby stopping them from being
# unmounted.
- imagex unmount "$@" --lazy
+ wimunmount "$@" --lazy
}
cleanup() {
echo 'testing' > dir2/file
dd if=/dev/zero of=dir2/zeroes bs=4096 count=5
mkdir tmp.empty tmp.mnt tmp.apply tmp.orig
- imagex capture tmp.empty empty.wim --norpfix
+ wimcapture tmp.empty empty.wim --norpfix
}
if [ ! -r /dev/fuse ] || [ ! -w /dev/fuse ]; then
cd $TEST_SUBDIR
init
-# imagex mount
+# wimmount
for flag in "--compress=none" "--compress=maximum" "--compress=fast"; do
echo "Using flag $flag"
echo "Testing mounting WIM read-only"
- if ! imagex capture dir dir.wim $flag; then
+ if ! wimcapture dir dir.wim $flag; then
error "Failed to capture WIM"
fi
- if ! imagex mount dir.wim dir tmp.mnt; then
+ if ! wimmount dir.wim dir tmp.mnt; then
error "Failed to mount test WIM read-only. " \
"Please read any error messages above before reporting this test failure. "\
"Perhaps you don't have FUSE installed, or the FUSE kernel module isn't" \
error "Unmounting read-only WIM failed"
fi
echo "Testing unmount of read-only filesystem with --commit given"
- if ! imagex mount dir.wim dir tmp.mnt; then
+ if ! wimmount dir.wim dir tmp.mnt; then
error "Failed to re-mount WIM read-only"
fi
if ! imagex_unmount tmp.mnt --commit; then
rm -rf dir.wim
done
-# imagex mountrw
+# wimmountrw
echo "Testing mounting WIM read-write"
-if ! imagex capture dir dir.wim; then
+if ! wimcapture dir dir.wim; then
error "Failed to capture WIM"
fi
-if ! imagex mountrw dir.wim dir tmp.mnt; then
+if ! wimmountrw dir.wim dir tmp.mnt; then
error "Failed to mount test WIM read-write"
fi
echo "Testing unmounting WIM unmodified"
error "Failed to unmount test WIM unmodified"
fi
echo "Testing unmounting WIM unmodified with --commit and --check"
-if ! imagex mountrw dir.wim dir tmp.mnt; then
+if ! wimmountrw dir.wim dir tmp.mnt; then
error "Failed to re-mount test WIM read-write"
fi
if ! imagex_unmount tmp.mnt --commit --check; then
error "Failed to unmount read-write mounted WIM with changes commited (no changes made)"
fi
echo "Testing removing file from mounted WIM"
-if ! imagex mountrw dir.wim dir tmp.mnt; then
+if ! wimmountrw dir.wim dir tmp.mnt; then
error "Failed to re-mount test WIM read-write"
fi
if ! rm tmp.mnt/write.c; then
if ! imagex_unmount tmp.mnt --commit --check; then
error "Failed to unmount read-write mounted WIM"
fi
-if test "`imagex info dir.wim | grep Integrity | awk '{print $3}'`" != "yes"; then
+if test "`wiminfo dir.wim | grep Integrity | awk '{print $3}'`" != "yes"; then
error "Integrity information was not included"
fi
-if ! imagex apply dir.wim tmp.apply; then
+if ! wimapply dir.wim tmp.apply; then
error "Failed to apply WIM we had previously mounted read-write"
fi
if ! diff -q tmp.apply/newdir/zeroes1 tmp.apply/newdir/zeroes2; then
tar cf ../test.tar .
cd ..
- if ! imagex mountrw test.wim tmp.mnt --unix-data; then
+ if ! wimmountrw test.wim tmp.mnt --unix-data; then
error "Failed to mount WIM read-write"
fi
if ! imagex_unmount tmp.mnt --commit; then
error "Failed to unmount WIM mounted read-write"
fi
- if ! imagex apply test.wim tmp.apply; then
+ if ! wimapply test.wim tmp.apply; then
error "Failed to apply WIM we previously had mounted read-write"
fi
do_tree_cmp tmp.orig tmp.apply
eval "$1"
cd ..
__do_unmount in.mnt
- if ! imagex capture in.ntfs ntfs.wim; then
+ if ! wimcapture in.ntfs ntfs.wim; then
error "Failed to capture NTFS volume into a WIM"
fi
- if ! imagex apply ntfs.wim 1 out.ntfs; then
+ if ! wimapply ntfs.wim 1 out.ntfs; then
error "Failed to apply WIM to NTFS volume"
fi
__do_mount in.ntfs in.mnt noatime
#!/usr/bin/env bash
-# Test `imagex update' and `imagex extract'.
+# Test `wimupdate' and `wimextract'.
set -e
cd tests
prepare_empty_wim() {
rm -rf in.dir
mkdir in.dir
- imagex capture in.dir test.wim --compress=none
+ wimcapture in.dir test.wim --compress=none
}
do_apply() {
rm -rf out.dir
- imagex apply test.wim out.dir
+ wimapply test.wim out.dir
}
prepare_empty_wim
echo 2 > 2
msg "Testing deleting nonexisting file from WIM image, without --force (errors expected)"
-! imagex update test.wim << EOF
+! wimupdate test.wim << EOF
delete /nonexistent
EOF
msg "Testing deleting nonexisting file from WIM image, with --force"
-! imagex update test.wim << EOF
+! wimupdate test.wim << EOF
delete --force /nonexistent
EOF
msg "Testing deleting root directory from WIM image, without --recursive (errors expected)"
-! imagex update test.wim << EOF
+! wimupdate test.wim << EOF
delete /
EOF
msg "Testing deleting root directory from WIM image, with --recursive"
-imagex update test.wim << EOF
+wimupdate test.wim << EOF
delete --recursive /
EOF
msg "Testing update command with invalid option (errors expected)"
-! imagex update test.wim << EOF
+! wimupdate test.wim << EOF
delete --invalid-option --recursive /
EOF
msg "Testing update command with too many arguments (errors expected)"
-! imagex update test.wim << EOF
+! wimupdate test.wim << EOF
delete --recursive --force / /anotherdir
EOF
msg "Testing invalid update command (errors expected)"
-! imagex update test.wim << EOF
+! wimupdate test.wim << EOF
invalid /
EOF
msg "Testing update command file with comments and empty lines"
-imagex update test.wim << EOF
+wimupdate test.wim << EOF
# this is a comment
# comment
EOF
msg "Testing update with --rebuild"
-imagex update --rebuild test.wim < /dev/null
+wimupdate --rebuild test.wim < /dev/null
for flag in "" "--rebuild"; do
msg "Testing adding file to WIM image with flag \"$flag\""
- imagex update test.wim $flag << EOF
+ wimupdate test.wim $flag << EOF
add file /file
EOF
do_apply
../tree-cmp file out.dir/file
msg "Testing deleting file from WIM image"
- imagex update test.wim << EOF
+ wimupdate test.wim << EOF
delete /file
EOF
do_apply
done
msg "Testing renaming file in WIM image"
-imagex update test.wim << EOF
+wimupdate test.wim << EOF
add file /file
EOF
-imagex update test.wim << EOF
+wimupdate test.wim << EOF
rename file newname
EOF
do_apply
prepare_empty_wim
msg "Testing adding, then renaming file in WIM image in one command"
-imagex update test.wim << EOF
+wimupdate test.wim << EOF
add file /file
rename /file /newname
EOF
msg "Testing adding additional file to WIM image"
prepare_empty_wim
-imagex update test.wim << EOF
+wimupdate test.wim << EOF
add 1 /1
EOF
-imagex update test.wim << EOF
+wimupdate test.wim << EOF
add file /file
EOF
do_apply
msg "Testing extracting file from WIM image"
rm -rf out.dir && mkdir out.dir
-imagex extract test.wim 1 /file --dest-dir=out.dir
+wimextract test.wim 1 /file --dest-dir=out.dir
../tree-cmp file out.dir/file && [ ! -e out.dir/1 ]
msg "Testing extracting file from WIM image to stdout"
rm -rf out.dir && mkdir out.dir
-imagex_raw extract test.wim 1 /file --to-stdout > out.dir/file
+wimlib_imagex extract test.wim 1 /file --to-stdout > out.dir/file
../tree-cmp file out.dir/file && [ ! -e out.dir/1 ]
msg "Testing adding directories and files to WIM image"
ln dir1/5 dir1/5link
ln dir2/6 dir2/6link
prepare_empty_wim
-imagex update test.wim 1 << EOF
+wimupdate test.wim 1 << EOF
add dir1 /dir1
add dir2 /prefix/dir2
EOF
rm -rf out.dir && mkdir out.dir
-imagex extract test.wim 1 dir1 --dest-dir=out.dir
-imagex extract test.wim 1 prefix/dir2 --dest-dir=out.dir
+wimextract test.wim 1 dir1 --dest-dir=out.dir
+wimextract test.wim 1 prefix/dir2 --dest-dir=out.dir
../tree-cmp dir1 out.dir/dir1
../tree-cmp dir2 out.dir/dir2
msg "Testing adding files to WIM image"
rm -rf in.dir && mkdir in.dir
-imagex append in.dir test.wim "2"
+wimappend in.dir test.wim "2"
cp $srcdir/src/*.c in.dir
-imagex update test.wim 2 << EOF
+wimupdate test.wim 2 << EOF
add in.dir /
add file /file
EOF
cp file in.dir/file
rm -rf out.dir
-imagex apply test.wim 2 out.dir
+wimapply test.wim 2 out.dir
../tree-cmp in.dir out.dir
msg "Testing adding file with space in it"
echo hello > "Some File"
prepare_empty_wim
-imagex update test.wim 1 << EOF
+wimupdate test.wim 1 << EOF
add "Some File" 'Some Destination'
EOF
rm -rf out.dir
-imagex apply test.wim 1 out.dir
+wimapply test.wim 1 out.dir
../tree-cmp "Some File" out.dir/"Some Destination"
msg "Testing path list extract"
echo hello2 > hello2
echo otherfile > otherfile
prepare_empty_wim
-imagex update test.wim 1 << EOF
+wimupdate test.wim 1 << EOF
add hello1 /hello1
add hello2 /hello2
add otherfile /otherfile
hello2
EOF
rm -rf out.dir
-imagex extract test.wim 1 @pathlist --dest-dir=out.dir
+wimextract test.wim 1 @pathlist --dest-dir=out.dir
../tree-cmp hello1 out.dir/hello1
../tree-cmp hello2 out.dir/hello2
[ ! -e out.dir/otherfile ]
hello*
EOF
rm -rf out.dir
-imagex extract test.wim 1 @pathlist --dest-dir=out.dir
+wimextract test.wim 1 @pathlist --dest-dir=out.dir
../tree-cmp hello1 out.dir/hello1
../tree-cmp hello2 out.dir/hello2
[ ! -e out.dir/otherfile ]
EOF
rm -rf out.dir
msg "Testing path list extract (no wildcard, no match; error expected)"
-! imagex extract test.wim 1 @pathlist --dest-dir=out.dir --no-wildcards
+! wimextract test.wim 1 @pathlist --dest-dir=out.dir --no-wildcards
cat > pathlist << EOF
foobar*
EOF
rm -rf out.dir
msg "Testing path list extract (wildcard, no match; error expected)"
-! imagex extract test.wim 1 @pathlist --dest-dir=out.dir
+! wimextract test.wim 1 @pathlist --dest-dir=out.dir
msg "Testing path list extract (wildcard, no match, nullglob; no error expected)"
-imagex extract test.wim 1 @pathlist --dest-dir=out.dir --nullglob
+wimextract test.wim 1 @pathlist --dest-dir=out.dir --nullglob
msg "Testing path list extract (w/ wildcard)"
cat > pathlist << EOF
*
EOF
rm -rf out.dir
-imagex extract test.wim 1 @pathlist --dest-dir=out.dir
+wimextract test.wim 1 @pathlist --dest-dir=out.dir
../tree-cmp hello1 out.dir/hello1
../tree-cmp hello2 out.dir/hello2
../tree-cmp otherfile out.dir/otherfile
msg "Testing path list extract (subdir files)"
prepare_empty_wim
-imagex update test.wim 1 << EOF
+wimupdate test.wim 1 << EOF
add hello1 /topdir/subdir1/hello1
add hello2 /topdir/subdir2/hello2
add hello1 /topdir/hello1
/topdir/subdir?/hello*
EOF
rm -rf out.dir
-imagex extract test.wim 1 @pathlist --dest-dir=out.dir
+wimextract test.wim 1 @pathlist --dest-dir=out.dir
../tree-cmp hello1 out.dir/topdir/subdir1/hello1
../tree-cmp hello2 out.dir/topdir/subdir2/hello2
[ ! -e out.dir/topdir/hello1 ]
msg "Testing case insensitivity"
prepare_empty_wim
-imagex update test.wim 1 << EOF
+wimupdate test.wim 1 << EOF
add hello1 /HELLO1
EOF
cat > pathlist << EOF
hello1
EOF
rm -rf out.dir
-! WIMLIB_IMAGEX_IGNORE_CASE=0 imagex extract test.wim 1 @pathlist --dest-dir=out.dir
-! WIMLIB_IMAGEX_IGNORE_CASE=0 imagex extract test.wim 1 @pathlist --dest-dir=out.dir --no-wildcards
-WIMLIB_IMAGEX_IGNORE_CASE=1 imagex extract test.wim 1 @pathlist --dest-dir=out.dir
-WIMLIB_IMAGEX_IGNORE_CASE=1 imagex extract test.wim 1 @pathlist --dest-dir=out.dir --no-wildcards
+! WIMLIB_IMAGEX_IGNORE_CASE=0 wimextract test.wim 1 @pathlist --dest-dir=out.dir
+! WIMLIB_IMAGEX_IGNORE_CASE=0 wimextract test.wim 1 @pathlist --dest-dir=out.dir --no-wildcards
+WIMLIB_IMAGEX_IGNORE_CASE=1 wimextract test.wim 1 @pathlist --dest-dir=out.dir
+WIMLIB_IMAGEX_IGNORE_CASE=1 wimextract test.wim 1 @pathlist --dest-dir=out.dir --no-wildcards
../tree-cmp hello1 out.dir/HELLO1
[ ! -e out.dir/topdir/hello1 ]
echo "**********************************************************"
-echo " imagex update/extract tests passed "
+echo " wimupdate/extract tests passed "
echo "**********************************************************"
trap exit
fi
}
-imagex()
+wimlib_imagex()
{
- echo "imagex $@"
- if [[ $1 == info || $1 == mountrw ]]; then
- ../../wimlib-imagex "$@"
- else
- ../../wimlib-imagex "$@" > /dev/null
- fi
+ ../../wimlib-imagex "$@"
}
-imagex_raw()
+wimappend()
{
- ../../wimlib-imagex "$@"
+ wimlib_imagex append "$@" > null
+}
+
+wimapply()
+{
+ wimlib_imagex apply "$@" > null
+}
+
+wimcapture()
+{
+ wimlib_imagex capture "$@" > null
+}
+
+wimdelete()
+{
+ wimlib_imagex delete "$@" > null
+}
+
+wimdir()
+{
+ wimlib_imagex dir "$@"
+}
+
+wimexport()
+{
+ wimlib_imagex export "$@" > null
+}
+
+wimextract()
+{
+ wimlib_imagex extract "$@" > null
+}
+
+wiminfo()
+{
+ wimlib_imagex info "$@"
+}
+
+wimjoin()
+{
+ wimlib_imagex join "$@" > null
+}
+
+wimmount()
+{
+ wimlib_imagex mount "$@" > null
+}
+
+wimmountrw()
+{
+ wimlib_imagex mountrw "$@" > null
+}
+
+wimoptimize()
+{
+ wimlib_imagex optimize "$@" > null
+}
+
+wimsplit()
+{
+ wimlib_imagex split "$@" > null
+}
+
+wimunmount()
+{
+ wimlib_imagex unmount "$@" > null
+}
+
+wimupdate()
+{
+ wimlib_imagex update "$@" > null
+}
+
+wimverify()
+{
+ wimlib_imagex verify "$@" > null
}
wim_ctype()
{
- imagex info $1 | grep Compression | awk '{print $2}'
+ wiminfo $1 | grep Compression | awk '{print $2}'
}
default_cleanup()