-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Make test scripts do not rely on current working directory
For better support for out-of-tree builds, this removes assumption in which directory the test scripts are running. Signed-off-by: Daiki Ueno <[email protected]>
- Loading branch information
Showing
8 changed files
with
51 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
# Copyright (C) 2022 Simo Sorce <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
: ${TESTBLDDIR=.} | ||
|
||
title() | ||
{ | ||
case "$1" in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,30 +2,32 @@ | |
# Copyright (C) 2022 Simo sorce <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
TEST_PATH=$(dirname "${1}") | ||
: ${TEST_PATH=$(dirname "${1}")} | ||
BNAME=$(basename "${1}") | ||
|
||
: ${TESTBLDDIR=.} | ||
|
||
# the test name is {TEST_NAME}-{TOKEN_DRIVER}.t | ||
# split extension | ||
NAME=${BNAME%.*} | ||
TEST_NAME=${NAME%-*} | ||
TOKEN_DRIVER=${NAME#*-} | ||
|
||
if [ -f "./tmp.${TOKEN_DRIVER}/testvars" ]; then | ||
if [ -f "${TESTBLDDIR}/tmp.${TOKEN_DRIVER}/testvars" ]; then | ||
# shellcheck source=/dev/null # we do not care about linting this source | ||
source "./tmp.${TOKEN_DRIVER}/testvars" | ||
source "${TESTBLDDIR}/tmp.${TOKEN_DRIVER}/testvars" | ||
else | ||
exit 77 # token not configured, skip | ||
fi | ||
|
||
# some tests are compiled, others are just distributed scripts | ||
# so we need to check both the current tests build dir and the | ||
# source tests dir in the out-of-source buils case (used by | ||
# source tests dir in the out-of-source build case (used by | ||
# make distcheck for example) | ||
if [ -f "${TEST_PATH}/t${TEST_NAME}" ]; then | ||
COMMAND="${TEST_PATH}/t${TEST_NAME}" | ||
else | ||
COMMAND="./t${TEST_NAME}" | ||
COMMAND="${TESTBLDDIR}/t${TEST_NAME}" | ||
fi | ||
|
||
# Run the tests under valgrind with appropriate flags | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters