gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/tools/gpu/all_drivers_test.sh (about)

     1  #!/bin/bash
     2  
     3  # Copyright 2023 The gVisor Authors.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  # Script to easily run gpu tests on all supported driver versions. This should
    18  # be run from the gVisor repo root directory.
    19  set -ueo pipefail
    20  
    21  tmp_file=$(mktemp)
    22  trap "rm -f ${tmp_file}" EXIT
    23  
    24  make sudo TARGETS=tools/gpu:main ARGS="list --outfile=${tmp_file}"
    25  read -r -a versions <<< "$(cat "${tmp_file}")"
    26  
    27  num_successful=0
    28  for driver in "${versions[@]}"; do
    29    set +e
    30    make sudo TARGETS=tools/gpu:main ARGS="install --version ${driver}"
    31    install_exit_code=$?
    32    set -e
    33    if [[ $install_exit_code -ne 0 ]]; then
    34      echo "Installing driver ${driver} failed. Not testing this version." >&2
    35      continue
    36    fi
    37    make gpu-smoke-tests RUNTIME_ARGS="--debug"
    38    num_successful="$(( $num_successful + 1 ))"
    39  done
    40  if [[ "$num_successful" == 0 ]]; then
    41    echo 'No version was successfully tested.' >&2
    42    exit 1
    43  fi