aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tools/ci_build/windows/bazel/bazel_test_lib.sh
blob: 0482cf619a831ebb87e76cd18efbdac83a0d2f11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
#

function run_configure_for_cpu_build {
  yes "" | ./configure
}

function run_configure_for_gpu_build {
  # Enable CUDA support
  export TF_NEED_CUDA=1

  yes "" | ./configure
}

function set_remote_cache_options {
  echo "build --remote_instance_name=projects/tensorflow-testing-cpu" >> "${TMP_BAZELRC}"
  echo "build --experimental_remote_platform_override='properties:{name:\"build\" value:\"windows-x64\"}'" >> "${TMP_BAZELRC}"
  echo "build --remote_cache=remotebuildexecution.googleapis.com" >> "${TMP_BAZELRC}"
  echo "build --tls_enabled=true" >> "${TMP_BAZELRC}"
  echo "build --remote_timeout=3600" >> "${TMP_BAZELRC}"
  echo "build --auth_enabled=true" >> "${TMP_BAZELRC}"
  echo "build --spawn_strategy=standalone" >> "${TMP_BAZELRC}"
  echo "build --strategy=Javac=standalone" >> "${TMP_BAZELRC}"
  echo "build --strategy=Closure=standalone" >> "${TMP_BAZELRC}"
  echo "build --genrule_strategy=standalone" >> "${TMP_BAZELRC}"
  echo "build --google_credentials=$GOOGLE_CLOUD_CREDENTIAL" >> "${TMP_BAZELRC}"
}

function create_python_test_dir() {
  rm -rf "$1"
  mkdir -p "$1"
  cmd /c "mklink /J $1\\tensorflow .\\tensorflow"
}

function reinstall_tensorflow_pip() {
  echo "y" | pip uninstall tensorflow -q || true
  pip install ${1} --no-deps
}