| 1 |
@echo off |
| 2 |
REM Run a subset of unit tests under PsExec -l (Low Mandatory Integrity). |
| 3 |
REM Low Integrity strips admin and sandboxes like IE Protected Mode (LocalLow |
| 4 |
REM temp, no HKCU writes, no recycle bin). Exclude those tests here. |
| 5 |
setlocal |
| 6 |
set "LOW_DIR=%USERPROFILE%\AppData\LocalLow" |
| 7 |
set "LOG=%LOW_DIR%\psexec_tests.log" |
| 8 |
set "TEMP=%LOW_DIR%" |
| 9 |
set "TMP=%LOW_DIR%" |
| 10 |
set "DESTRUCTIVE_TESTS=T" |
| 11 |
set "PYTHONWARNINGS=error" |
| 12 |
set "GITHUB_ACTIONS=true" |
| 13 |
set "COVERAGE_FILE=%LOW_DIR%\.coverage.psexec" |
| 14 |
set "BLEACHBIT_TEST_OPTIONS_DIR=%LOW_DIR%\BleachBit" |
| 15 |
|
| 16 |
( |
| 17 |
echo === psexec low integrity tests === |
| 18 |
echo CD=%CD% |
| 19 |
echo PYTHON_EXE=%PYTHON_EXE% |
| 20 |
echo TEMP=%TEMP% |
| 21 |
echo COVERAGE_FILE=%COVERAGE_FILE% |
| 22 |
) > "%LOG%" |
| 23 |
|
| 24 |
if not defined PYTHON_EXE ( |
| 25 |
echo ERROR: PYTHON_EXE is not set>> "%LOG%" |
| 26 |
exit /b 1 |
| 27 |
) |
| 28 |
|
| 29 |
cd /d "%~dp0.." |
| 30 |
if errorlevel 1 ( |
| 31 |
echo ERROR: Failed to cd to repo root>> "%LOG%" |
| 32 |
exit /b 1 |
| 33 |
) |
| 34 |
|
| 35 |
echo Repo root: %CD%>> "%LOG%" |
| 36 |
echo.>> "%LOG%" |
| 37 |
|
| 38 |
REM -u keeps stdout in order with stderr when both are redirected to the log |
| 39 |
"%PYTHON_EXE%" -u -m coverage run -m unittest -v ^ |
| 40 |
tests.TestWorker.WorkerTestCase.test_Locked ^ |
| 41 |
tests.TestWorker.WorkerTestCase.test_AccessDenied ^ |
| 42 |
tests.TestWorker.WorkerTestCase.test_DoesNotExist ^ |
| 43 |
tests.TestWorker.WorkerTestCase.test_RuntimeError ^ |
| 44 |
tests.TestWorker.WorkerTestCase.test_Truncate ^ |
| 45 |
tests.TestWindows.WindowsTestCase.test_run_net_service_command_not_admin ^ |
| 46 |
tests.TestWindows.WindowsTestCase.test_delete_updates ^ |
| 47 |
tests.TestWindows.WindowsTestCase.test_delete_parent_lock_needed ^ |
| 48 |
tests.TestWindows.WindowsTestCase.test_delete_with_parent_lock_reuses_handle ^ |
| 49 |
tests.TestWindows.WindowsTestCase.test_delete_with_parent_lock_closes_handle_on_delete_error ^ |
| 50 |
tests.TestWindows.WindowsTestCase.test_delete_locked_file >> "%LOG%" 2>&1 |
| 51 |
exit /b %ERRORLEVEL% |