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/cpu/pip/ 33 # Change into repository root. 34 script_dir=$(dirname $0) 35 cd ${script_dir%%tensorflow/tools/ci_build/windows/cpu/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_cpu_build 46 47 # --define=override_eigen_strong_inline=true speeds up the compiling of conv_grad_ops_3d.cc and conv_ops_3d.cc 48 # by 20 minutes. See https://github.com/tensorflow/tensorflow/issues/10521 49 BUILD_OPTS="--define=override_eigen_strong_inline=true" 50 bazel build -c opt $BUILD_OPTS tensorflow/tools/pip_package:build_pip_package || exit $? 51 52 # Create a python test directory to avoid package name conflict 53 PY_TEST_DIR="py_test_dir" 54 create_python_test_dir "${PY_TEST_DIR}" 55 56 ./bazel-bin/tensorflow/tools/pip_package/build_pip_package "$PWD/${PY_TEST_DIR}" 57 58 # Running python tests on Windows needs pip package installed 59 PIP_NAME=$(ls ${PY_TEST_DIR}/tensorflow-*.whl) 60 reinstall_tensorflow_pip ${PIP_NAME} 61 62 # Define no_tensorflow_py_deps=true so that every py_test has no deps anymore, 63 # which will result testing system installed tensorflow 64 bazel test -c opt $BUILD_OPTS -k --test_output=errors \ 65 --define=no_tensorflow_py_deps=true --test_lang_filters=py \ 66 --test_tag_filters=-no_pip,-no_windows,-no_oss \ 67 --build_tag_filters=-no_pip,-no_windows,-no_oss --build_tests_only \ 68 //${PY_TEST_DIR}/tensorflow/python/... 69