summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/common.sh13
-rwxr-xr-xtests/futility/run_test_scripts.sh3
-rwxr-xr-xtests/gen_fuzz_test_cases.sh2
-rwxr-xr-xtests/test_using_qemu.sh40
4 files changed, 8 insertions, 50 deletions
diff --git a/tests/common.sh b/tests/common.sh
index 78512254..ed1c9f06 100644
--- a/tests/common.sh
+++ b/tests/common.sh
@@ -7,14 +7,13 @@
# Determine script directory.
SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
ROOT_DIR="$(dirname "${SCRIPT_DIR}")"
-SRCDIR="${SRCDIR:-${ROOT_DIR}}"
-BUILD="${BUILD:-${ROOT_DIR}/build}"
-BUILD_RUN="${BUILD_RUN:-${BUILD}}"
-SRC_RUN="${SRC_RUN:-${SRCDIR}}"
-BUILD_DIR="${BUILD}"
-BIN_DIR="${BUILD_DIR}/install_for_test/usr/bin"
+SRCDIR="${ROOT_DIR}"
+# BUILD_RUN should be supplied from the Makefile.
+# Some test scripts change the cwd so use an absolute path.
+BUILD_RUN="$(realpath "${BUILD_RUN}")"
+BIN_DIR="${BUILD_RUN}/install_for_test/usr/bin"
FUTILITY="${BIN_DIR}/futility"
-TEST_DIR="${BUILD_DIR}/tests"
+TEST_DIR="${BUILD_RUN}/tests"
TESTKEY_DIR="${SCRIPT_DIR}/testkeys"
TESTCASE_DIR="${SCRIPT_DIR}/testcases"
TESTKEY_SCRATCH_DIR="${TEST_DIR}/testkeys"
diff --git a/tests/futility/run_test_scripts.sh b/tests/futility/run_test_scripts.sh
index dc87f76b..09086998 100755
--- a/tests/futility/run_test_scripts.sh
+++ b/tests/futility/run_test_scripts.sh
@@ -6,11 +6,10 @@
# Load common constants and variables.
. "$(dirname "$0")/../common.sh"
-OUTDIR="${BUILD}/tests/futility_test_results"
+OUTDIR="${BUILD_RUN}/tests/futility_test_results"
[ -d "$OUTDIR" ] || mkdir -p "$OUTDIR"
# Let each test know where to find things...
-export BUILD
export BUILD_RUN
export SRCDIR
export FUTILITY
diff --git a/tests/gen_fuzz_test_cases.sh b/tests/gen_fuzz_test_cases.sh
index 1dede33d..0a9f6942 100755
--- a/tests/gen_fuzz_test_cases.sh
+++ b/tests/gen_fuzz_test_cases.sh
@@ -13,7 +13,7 @@ set -e
# Use a different directory for fuzzing test cases.
TESTKEY_DIR=${TESTKEY_DIR:-$(realpath "${SCRIPT_DIR}"/../tests/testkeys)}
-TESTCASE_DIR=${BUILD_DIR}/fuzz_testcases
+TESTCASE_DIR=${BUILD_RUN}/fuzz_testcases
TEST_IMAGE_FILE=${TESTCASE_DIR}/testimage
TEST_IMAGE_SIZE=500000
TEST_BOOTLOADER_FILE=${TESTCASE_DIR}/testbootloader
diff --git a/tests/test_using_qemu.sh b/tests/test_using_qemu.sh
deleted file mode 100755
index 99669d5e..00000000
--- a/tests/test_using_qemu.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2013 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Script to run a test under qemu
-#
-# Usage:
-# test_using_qemu.sh (command line to run)
-#
-# Required environment variables:
-# BUILD_RUN - path to build directory inside chroot
-# HOME - home directory inside chroot
-# QEMU_RUN - path to QEMU binary inside chroot
-# SYSROOT - path to root for target platform, outside chroot
-
-set -e
-
-# Set up mounts
-sudo mkdir -p "${SYSROOT}/proc" "${SYSROOT}/dev"
-sudo mount --bind /proc "${SYSROOT}/proc"
-sudo mount --bind /dev "${SYSROOT}/dev"
-
-# Don't exit on error, so we can capture the error code
-set +e
-sudo chroot "${SYSROOT}" "${QEMU_RUN}" \
- -E LD_LIBRARY_PATH=/lib64:/lib:/usr/lib64:/usr/lib \
- -E HOME="${HOME}" \
- -E BUILD="${BUILD_RUN}" \
- -- "$@"
-exit_code=$?
-set -e
-
-# Clean up mounts
-sudo umount -l "${SYSROOT}/proc"
-sudo umount -l "${SYSROOT}/dev"
-
-# Pass through exit code from command
-exit $exit_code