1call %SCRIPT_HELPERS_DIR%\setup_pytorch_env.bat 2if errorlevel 1 exit /b 1 3 4:: Save the current working directory so that we can go back there 5set CWD=%cd% 6 7set CPP_TESTS_DIR=%TMP_DIR_WIN%\build\torch\bin 8set PATH=%TMP_DIR_WIN%\build\torch\lib;%PATH% 9 10set TORCH_CPP_TEST_MNIST_PATH=%CWD%\test\cpp\api\mnist 11python tools\download_mnist.py --quiet -d %TORCH_CPP_TEST_MNIST_PATH% 12 13python test\run_test.py --cpp --verbose -i cpp/test_api 14if errorlevel 1 exit /b 1 15if not errorlevel 0 exit /b 1 16 17cd %TMP_DIR_WIN%\build\torch\test 18for /r "." %%a in (*.exe) do ( 19 call :libtorch_check "%%~na" "%%~fa" 20 if errorlevel 1 goto fail 21) 22 23goto :eof 24 25:libtorch_check 26 27cd %CWD% 28set CPP_TESTS_DIR=%TMP_DIR_WIN%\build\torch\test 29 30:: Skip verify_api_visibility as it a compile level test 31if "%~1" == "verify_api_visibility" goto :eof 32 33echo Running "%~2" 34if "%~1" == "c10_intrusive_ptr_benchmark" ( 35 :: NB: This is not a gtest executable file, thus couldn't be handled by pytest-cpp 36 call "%~2" 37 goto :eof 38) 39 40python test\run_test.py --cpp --verbose -i "cpp/%~1" 41if errorlevel 1 ( 42 echo %1 failed with exit code %errorlevel% 43 goto fail 44) 45if not errorlevel 0 ( 46 echo %1 failed with exit code %errorlevel% 47 goto fail 48) 49 50:eof 51exit /b 0 52 53:fail 54exit /b 1 55