]> wimlib.net Git - wimlib/blobdiff - tests/win32-test-imagex-capture_and_apply.bat
win32_capture_try_rpfix(): Fix incorrect conditional
[wimlib] / tests / win32-test-imagex-capture_and_apply.bat
index 023beaf4a8329ee6e93f6c183dad682dcd17d7cc..01e3f32099894b8a8ddeb90774cceecf6b37ef7a 100644 (file)
@@ -6,10 +6,12 @@ REM
 REM Run some tests on the Windows version of wimlib-imagex.\r
 REM\r
 REM This must be run on Windows Vista or later in a clean directory, with\r
-REM Administrator privileges.  wimlib-imagex and win32-tree-cmp must be callable\r
-REM (on PATH or in same directory).\r
+REM Administrator privileges.  wimlib-imagex and win32-tree-cmp must be\r
+REM executable using the paths set below.\r
 \r
 setlocal EnableDelayedExpansion\r
+set WIN32_TREE_CMP=win32-tree-cmp\r
+set WIMLIB_IMAGEX=wimlib-imagex\r
 \r
 if exist in.dir rd /S /Q in.dir\r
 if exist out.dir rd /S /Q out.dir\r
@@ -20,6 +22,8 @@ REM
 REM BEGIN TESTS\r
 REM\r
 \r
+REM goto :rpfix_tests\r
+\r
 call :msg "empty directory"\r
 call :do_test\r
 if %errorlevel% neq 0 exit /b %errorlevel%\r
@@ -257,19 +261,114 @@ attrib +h hidden
 call :do_test\r
 if %errorlevel% neq 0 exit /b %errorlevel%\r
 \r
+call :msg "hidden directory"\r
+md subdir\r
+attrib +h subdir\r
+call :do_test\r
+if %errorlevel% neq 0 exit /b %errorlevel%\r
+\r
+call :msg "encrypted file"\r
+echo "hello" > encrypted\r
+cipher /e encrypted > nul\r
+call :do_test\r
+if %errorlevel% neq 0 exit /b %errorlevel%\r
+\r
+call :msg "identical encrypted files"\r
+echo "hello" > encrypted1\r
+echo "hello" > encrypted2\r
+cipher /e encrypted1 > nul\r
+cipher /e encrypted2 > nul\r
+call :do_test\r
+if %errorlevel% neq 0 exit /b %errorlevel%\r
+\r
+call :msg "encrypted directory"\r
+md subdir\r
+cipher /e subdir > nul\r
+call :do_test\r
+if %errorlevel% neq 0 exit /b %errorlevel%\r
+\r
+call :msg "encrypted directory with encrypted file in it"\r
+md subdir\r
+echo 1 > subdir\1\r
+cipher /e subdir > nul\r
+cipher /e subdir\1 > nul\r
+call :do_test\r
+if %errorlevel% neq 0 exit /b %errorlevel%\r
+\r
+call :msg "encrypted directory with unencrypted file in it"\r
+md subdir\r
+echo 1 > subdir\1\r
+cipher /e subdir > nul\r
+cipher /d subdir\1 > nul\r
+call :do_test\r
+if %errorlevel% neq 0 exit /b %errorlevel%\r
+\r
+call :msg "hardlinked, encrypted file with alternate data streams"\r
+echo hello > file\r
+echo hello > file:ads\r
+cipher /e file > nul\r
+mklink /h link file > nul\r
+call :do_test\r
+if %errorlevel% neq 0 exit /b %errorlevel%\r
+\r
+:rpfix_tests\r
+\r
+echo Testing rpfix junction\r
+md subdir\r
+echo 1 > subdir\file\r
+mklink /j junction subdir > nul\r
+cd ..\r
+%WIMLIB_IMAGEX% capture in.dir test.wim > nul\r
+rd /s /q in.dir\r
+%WIMLIB_IMAGEX% apply test.wim out.dir > nul\r
+echo 1 > tmp1\r
+type out.dir\junction\file > tmp2\r
+fc tmp1 tmp2 > nul\r
+if %errorlevel% neq 0 exit /b %errorlevel%\r
+rd /s /q out.dir\r
+del tmp1 tmp2\r
+md in.dir\r
+cd in.dir\r
+\r
+echo Testing rpfix exclude\r
+mklink otherlink c:\some\other\directory > nul\r
+cd ..\r
+%WIMLIB_IMAGEX% capture in.dir test.wim > nul\r
+%WIMLIB_IMAGEX% apply test.wim out.dir > nul\r
+rd out.dir\r
+if %errorlevel% neq 0 exit /b %errorlevel%\r
+rd /s /q in.dir\r
+md in.dir\r
+cd in.dir\r
+\r
+echo Testing rpfix relative\r
+echo 1 > file\r
+mklink relink file > nul\r
+cd ..\r
+%WIMLIB_IMAGEX% capture in.dir test.wim > nul\r
+%WIMLIB_IMAGEX% apply test.wim out.dir > nul\r
+fc in.dir\file out.dir\relink > nul\r
+if %errorlevel% neq 0 exit /b %errorlevel%\r
+rd /s /q in.dir out.dir\r
+md in.dir\r
+cd in.dir\r
+\r
 REM\r
 REM END OF TESTS\r
 REM\r
 \r
+cd ..\r
+del test.wim\r
+rd /s /q in.dir\r
 exit /b 0\r
 \r
 :do_test\r
 cd ..\r
-wimlib-imagex capture in.dir test.wim --norpfix > NUL\r
+%WIMLIB_IMAGEX% capture in.dir test.wim --norpfix > NUL\r
 if %errorlevel% neq 0 exit /b %errorlevel%\r
-wimlib-imagex apply test.wim out.dir > NUL\r
+%WIMLIB_IMAGEX% apply test.wim out.dir > NUL\r
 if %errorlevel% neq 0 exit /b %errorlevel%\r
-win32-tree-cmp in.dir out.dir\r
+%WIN32_TREE_CMP% in.dir out.dir\r
 if %errorlevel% neq 0 (\r
        echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
        echo            TEST FAILED!!!!!!!\r
@@ -286,7 +385,7 @@ REM imagex /capture in.dir test.wim "test" /norpfix > nul
 REM if %errorlevel% neq 0 exit /b %errorlevel%\r
 REM imagex /apply test.wim 1 out.dir > nul\r
 REM if %errorlevel% neq 0 exit /b %errorlevel%\r
-REM win32-tree-cmp in.dir out.dir\r
+REM %WIN32_TREE_CMP% in.dir out.dir\r
 REM if %errorlevel% neq 0 (\r
        REM echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
        REM echo            TEST FAILED!!!!!!! ^(imagex^)\r