]> wimlib.net Git - wimlib/blobdiff - tests/win32-test-imagex-capture_and_apply.bat
win32-test-imagex-capture_and_apply: sparse file tests
[wimlib] / tests / win32-test-imagex-capture_and_apply.bat
index 6ef76513b00344ea1fdc63466af6a25c598b7cc1..fda65ac8181ad8408666eefd01ab0cc6d732dcd9 100644 (file)
@@ -25,48 +25,40 @@ REM
 \r
 call :msg "empty directory"\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "single file"\r
 echo 1 > file\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "different files"\r
 echo 1 > file\r
 echo 2 > anotherfile\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "identical files"\r
 echo 1 > file\r
 echo 1 > identicalfile\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "hard linked file"\r
 echo 1 > file\r
 mklink /h link file > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "hard linked file, with other identical files"\r
 echo 1 > file\r
 mklink /h link file > nul\r
 echo 1 > identicalfile\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "empty file"\r
 type nul > emptyfile\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "hard linked empty file"\r
 type nul > file\r
 mklink /h link file > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "various hard linked, identical, different, and empty files"\r
 echo 1 > file\r
@@ -80,7 +72,6 @@ echo 5 > identicalfile
 echo 1 > 1file\r
 mklink /h 1filelink 1file > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "multiple subdirectories, some empty, some not"\r
 md subdir1\r
@@ -92,25 +83,21 @@ mklink /h link subdir1\1 > nul
 md subdir2\subdir2subdir\r
 type nul > subdir2\emptyfile\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "file with custom security descriptor"\r
 echo hello > file\r
 icacls file /deny Administrator:F > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "directory with custom security descriptor (inheritence enabled)"\r
 md subdir\r
 icacls subdir /inheritance:e > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "directory with custom security descriptor (inheritence disabled)"\r
 md subdir\r
 icacls subdir /inheritance:d > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 REM            win32-tree-cmp can't handle this case.\r
 REM\r
@@ -118,46 +105,38 @@ REM call :msg "file with custom security descriptor (all inherited ACEs removed)
 REM echo hello > file\r
 REM icacls file /inheritance:r > nul\r
 REM call :do_test\r
-REM if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "file with custom integrity level"\r
 echo hello > file\r
 icacls file /setintegritylevel H > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "relative symlink"\r
 mklink relink dest > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "absolute symlink, with drive letter"\r
 mklink abslink C:\absolute\target > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "absolute symlink, without drive letter"\r
 mklink abslink \absolute\target > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "relative symlink, with file target"\r
 echo 1 > 1\r
 mklink relink 1 > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "relative symlink, with directory target"\r
 md subdir\r
 mklink reldlink subdir > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "junction"\r
 md subdir\r
 mklink /j junction subdir > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "symlinks, junctions, files, subdirectories, etc."\r
 echo 1 > 1\r
@@ -177,13 +156,11 @@ md subdir2\s\s
 md subdir2\s\s\s\r
 echo "hello world!!!!" > subdir2\otherfile\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "reparse point that is neither a symlink nor a junction"\r
 type nul > file\r
 %SET_REPARSE_POINT% file\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "reparse point with named data streams"\r
 type nul > file\r
@@ -191,13 +168,11 @@ echo 11 > file:a
 echo 1 > file:aa\r
 %SET_REPARSE_POINT% file\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "reparse point with unnamed data stream"\r
 echo "test" > file\r
 %SET_REPARSE_POINT% file\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "reparse point with unnamed data stream and named data streams"\r
 echo "test" > file\r
@@ -205,19 +180,16 @@ echo 11 > file:a
 echo 1 > file:aa\r
 %SET_REPARSE_POINT% file\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "empty reparse point"\r
 type nul > file\r
 %SET_REPARSE_POINT% file 0\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "empty reparse point with unnamed data stream"\r
 echo hello > file\r
 %SET_REPARSE_POINT% file 0\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "empty reparse point with unnamed data stream and named data streams"\r
 echo hello > file\r
@@ -225,19 +197,16 @@ echo hello > file:ads1
 type nul > file:ads2\r
 %SET_REPARSE_POINT% file 0\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "maximum length reparse point"\r
 type nul > file\r
 %SET_REPARSE_POINT% file 16376\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "directory reparse point that is neither a symlink nor a junction"\r
 md subdir\r
 %SET_REPARSE_POINT% subdir\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "directory reparse point with named data streams"\r
 md subdir\r
@@ -245,19 +214,16 @@ echo 11 > subdir:a
 echo 1 > subdir:aa\r
 %SET_REPARSE_POINT% subdir\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "compressed file"\r
 echo "test" > test\r
 compact /C test > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "compressed directory"\r
 md subdir\r
 compact /C subdir > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "compressed directory with files in it"\r
 md subdir\r
@@ -269,7 +235,6 @@ md subdir\subsubdir
 mklink /h subdir\hardlink subdir\file1 > nul\r
 mklink /j subdir\j subdir\subsubdir > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "compressed directory with some uncompressed files in it"\r
 md subdir\r
@@ -278,13 +243,11 @@ echo 1 > subdir\1
 echo 5 > subdir\5\r
 compact /U subdir\1 > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "file with alternate data stream"\r
 echo 1 > file\r
 echo 5 > file:ads\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "file with multiple alternate data streams"\r
 echo 1 > file\r
@@ -293,7 +256,6 @@ echo aa > file:aa
 echo aaa > file:aaa\r
 echo aaaa > file:aaaa\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "file with multiple alternate data streams, with hard link"\r
 echo 1 > file\r
@@ -303,7 +265,6 @@ echo aaa > file:aaa
 echo aaaa > file:aaaa\r
 mklink /h link file > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "files with multiple alternate data streams, some identical, with hard link"\r
 echo 1 > file\r
@@ -315,29 +276,24 @@ echo 5 > file:5
 mklink /h link file > nul\r
 echo aaa > file2:aaa\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "file with empty alternate data stream"\r
 echo 1 > file\r
 type nul > file:ads\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "directory with empty alternate data stream"\r
 md subdir\r
 type nul > subdir:ads\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "root directory with alternate data stream"\r
 echo 1 > ..\in.dir:ads\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "root directory with empty alternate data stream"\r
 type nul > ..\in.dir:ads\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "subdirectory with alternate data streams"\r
 md subdir\r
@@ -345,7 +301,6 @@ echo 1 > subdir:1
 echo 2 > subdir:2\r
 echo 2 > subdir:2again\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "subdirectories and files with alternate data streams"\r
 md subdir\r
@@ -359,7 +314,6 @@ echo 8 > helloagain:8
 echo 1 > 1\r
 type nul > helloagain:dummy\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "symbolic link and hard link, to file with alternate data streams"\r
 echo 1 > 1\r
@@ -367,7 +321,6 @@ echo test > .\1:test
 mklink symlink 1 > nul\r
 mklink /h hardlink 1 > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "compressed file with alternate data streams"\r
 echo 1 > 1\r
@@ -375,56 +328,47 @@ echo 1 > .\1:1
 echo 2 > .\1:2\r
 compact /C 1 > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "hidden file"\r
 echo 1 > hidden\r
 attrib +h hidden\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "hidden system file"\r
 echo 1 > file\r
 attrib +h +s file\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "hidden, readonly, system file"\r
 echo 1 > file\r
 attrib +h +r +s file\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "hidden directory"\r
 md subdir\r
 attrib +h subdir\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "hidden system directory"\r
 md subdir\r
 attrib +h +s subdir\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "hidden, readonly, system directory"\r
 md subdir\r
 attrib +h +r +s subdir\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "readonly directory with named data stream"\r
 md subdir\r
 echo foo > subdir:ads\r
 attrib +r subdir\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "encrypted file"\r
 echo "hello" > encrypted\r
 cipher /e encrypted > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "identical encrypted files"\r
 echo "hello" > encrypted1\r
@@ -432,13 +376,11 @@ echo "hello" > encrypted2
 cipher /e encrypted1 > nul\r
 cipher /e encrypted2 > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "encrypted directory"\r
 md subdir\r
 cipher /e subdir > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "encrypted directory with encrypted file in it"\r
 md subdir\r
@@ -446,7 +388,6 @@ echo 1 > subdir\1
 cipher /e subdir > nul\r
 cipher /e subdir\1 > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "encrypted directory with unencrypted file in it"\r
 md subdir\r
@@ -454,7 +395,6 @@ echo 1 > subdir\1
 cipher /e subdir > nul\r
 cipher /d subdir\1 > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "encrypted root directory"\r
 cd ..\r
@@ -462,7 +402,6 @@ cipher /e in.dir > nul
 cd in.dir\r
 echo "hello" > encrypted\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "unencrypted file in encrypted directory in compressed directory"\r
 md 1\r
@@ -472,7 +411,6 @@ cipher /e 1\2 > nul
 echo hello > 1\2\file\r
 cipher /d 1\2\file > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "encrypted directory with alternate data streams"\r
 md subdir\r
@@ -480,7 +418,6 @@ cipher /e subdir > nul
 echo ads1 > subdir:ads1\r
 echo ads2 > subdir:ads2\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "hardlinked, encrypted file with alternate data streams"\r
 echo hello > file\r
@@ -488,7 +425,6 @@ echo hello > file:ads
 cipher /e file > nul\r
 mklink /h link file > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 REM Note: since object IDs must be unique per filesystem, we can't expect them\r
 REM to preserved using our testing scheme.  Therefore, win32-tree-cmp doesn't\r
@@ -499,13 +435,45 @@ call :msg "file with object ID"
 echo hello > file\r
 fsutil objectid create file > nul\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
 \r
 call :msg "directory with object ID"\r
 md subdir\r
 fsutil objectid set f67394c12b17608e1d050d181ba8ffd2 7df80cbdf620f4c82c79b9e6799147b6 97621aff72915ade05abb96b15dea1a3 e0bda4caa9e33cfd461c92c16be9713d subdir\r
 call :do_test\r
-if %errorlevel% neq 0 goto :fail\r
+\r
+call :msg "sparse files"\r
+fsutil file createnew sparse 1000000 > nul\r
+fsutil sparse setflag sparse\r
+fsutil sparse setrange sparse 0 1000000\r
+\r
+fsutil file createnew mostly_sparse 1000000 > nul\r
+fsutil sparse setflag mostly_sparse\r
+fsutil sparse setrange mostly_sparse 0 1000000\r
+echo hello >> mostly_sparse\r
+type sparse >> mostly_sparse\r
+fsutil sparse setrange mostly_sparse 1000100 2000000\r
+call :do_test\r
+\r
+call :msg "sparse and compressed files"\r
+fsutil file createnew sparse 1000000 > nul\r
+fsutil sparse setflag sparse\r
+fsutil sparse setrange sparse 0 1000000\r
+compact /c sparse > nul\r
+\r
+fsutil file createnew mostly_sparse 1000000 > nul\r
+fsutil sparse setflag mostly_sparse\r
+fsutil sparse setrange mostly_sparse 0 1000000\r
+echo hello >> mostly_sparse\r
+type sparse >> mostly_sparse\r
+fsutil sparse setrange mostly_sparse 1000100 2000000\r
+compact /c mostly_sparse > nul\r
+\r
+type nul > compressed_first\r
+compact /c compressed_first > nul\r
+type sparse >> compressed_first\r
+fsutil sparse setflag compressed_first\r
+fsutil sparse setrange compressed_first 0 500000\r
+call :do_test\r
 \r
 :rpfix_tests\r
 \r
@@ -588,4 +556,4 @@ goto :eof
 echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
 echo            TEST FAILED!!!!!!!\r
 echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
-exit /b %errorlevel%\r
+exit %errorlevel%\r