xref: /aosp_15_r20/external/tensorflow/tensorflow/tools/ci_build/presubmit/windows/gpu_py39_full/build.bat (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1echo on
2setlocal enableextensions enabledelayedexpansion
3
4SET PYTHON_DIRECTORY=Python39
5
6@REM This is the path to bazel_wrapper.py, should be set as an argument
7set BAZEL_WRAPPER_PATH=%~f1
8
9@REM Load common definitions, install bazel
10CALL tensorflow\tools\ci_build\release\common_win.bat
11
12@REM Set up common variables used through the script
13set WIN_OUT=win.out
14set WIN_OUT_TARGET=gen_win_out
15set BUILD_PATH=tensorflow/tools/ci_build/builds
16set GEN_SCRIPT=%BUILD_PATH%/%WIN_OUT_TARGET%.sh
17set GEN_BUILD=%BUILD_PATH%/BUILD
18
19@REM Run the presubmit win build.
20CALL tensorflow\tools\ci_build\windows\gpu\pip\run.bat --enable_remote_cache %* > %BUILD_PATH%/%WIN_OUT% 2>&1
21set RC=%errorlevel%
22
23@REM Since we are running the sanity build remotely (rbe), we need to build a bazel
24@REM target that would output the log generated above and return the expected
25@REM error code.
26echo package(default_visibility = ["//visibility:public"]) > %GEN_BUILD%
27echo. >> %GEN_BUILD%
28echo sh_test( >> %GEN_BUILD%
29echo     name = "%WIN_OUT_TARGET%", >> %GEN_BUILD%
30echo     srcs = ["%WIN_OUT_TARGET%.sh"], >> %GEN_BUILD%
31echo     data = ["%WIN_OUT%"], >> %GEN_BUILD%
32echo     tags = ["local"], >> %GEN_BUILD%
33echo ) >> %GEN_BUILD%
34
35echo #!/bin/bash > %GEN_SCRIPT%
36echo function rlocation() { >> %GEN_SCRIPT%
37echo   fgrep -m1 "$1 " "$RUNFILES_MANIFEST_FILE" ^| cut -d' ' -f2- >> %GEN_SCRIPT%
38echo } >> %GEN_SCRIPT%
39echo cat $(rlocation %BUILD_PATH%/%WIN_OUT%) >> %GEN_SCRIPT%
40echo exit %RC% >> %GEN_SCRIPT%
41
42@REM Now trigger the rbe build that outputs the log
43chmod +x %GEN_SCRIPT%
44
45@REM Run bazel test command.
46%PY_EXE% %BAZEL_WRAPPER_PATH% --output_user_root=%TMPDIR% ^
47  --host_jvm_args=-Dbazel.DigestFunction=SHA256 test ^
48  %BUILD_PATH%:%WIN_OUT_TARGET% --test_output=all ^
49  --experimental_ui_max_stdouterr_bytes=-1
50
51