1 #!/bin/bash 2 # Copyright 2016 The TensorFlow Authors. All Rights Reserved. 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # ============================================================================== 16 # 17 # This script assumes the standard setup on tensorflow Jenkins windows machines. 18 # It is NOT guaranteed to work on any other machine. Use at your own risk! 19 # 20 # REQUIREMENTS: 21 # * All installed in standard locations: 22 # - JDK8, and JAVA_HOME set. 23 # - Microsoft Visual Studio 2015 Community Edition 24 # - Msys2 25 # - Anaconda3 26 # * Bazel windows executable copied as "bazel.exe" and included in PATH. 27 28 # All commands shall pass, and all should be visible. 29 set -x 30 set -e 31 32 # This script is under <repo_root>/tensorflow/tools/ci_build/windows/gpu/pip/ 33 # Change into repository root. 34 script_dir=$(dirname $0) 35 cd ${script_dir%%tensorflow/tools/ci_build/windows/gpu/pip}. 36 37 # Setting up the environment variables Bazel and ./configure needs 38 source "tensorflow/tools/ci_build/windows/bazel/common_env.sh" \ 39 || { echo "Failed to source common_env.sh" >&2; exit 1; } 40 41 # load bazel_test_lib.sh 42 source "tensorflow/tools/ci_build/windows/bazel/bazel_test_lib.sh" \ 43 || { echo "Failed to source bazel_test_lib.sh" >&2; exit 1; } 44 45 run_configure_for_gpu_build 46 47 bazel build -c opt tensorflow/tools/pip_package:build_pip_package || exit $? 48 49 # Create a python test directory to avoid package name conflict 50 PY_TEST_DIR="py_test_dir" 51 create_python_test_dir "${PY_TEST_DIR}" 52 53 ./bazel-bin/tensorflow/tools/pip_package/build_pip_package "$PWD/${PY_TEST_DIR}" 54 55 # Running python tests on Windows needs pip package installed 56 PIP_NAME=$(ls ${PY_TEST_DIR}/tensorflow-*.whl) 57 reinstall_tensorflow_pip ${PIP_NAME} 58 59 # Define no_tensorflow_py_deps=true so that every py_test has no deps anymore, 60 # which will result testing system installed tensorflow 61 # GPU tests are very flaky when running concurrently, so set local_test_jobs=1 62 bazel test -c opt -k --test_output=errors \ 63 --define=no_tensorflow_py_deps=true --test_lang_filters=py \ 64 --test_tag_filters=-no_pip,-no_windows,-no_windows_gpu,-no_gpu,-no_pip_gpu,no_oss \ 65 --build_tag_filters=-no_pip,-no_windows,-no_windows_gpu,-no_gpu,-no_pip_gpu,no_oss \ 66 --local_test_jobs=1 --build_tests_only //${PY_TEST_DIR}/tensorflow/python/... 67