-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
common: unify testconfig generation scripts
Signed-off-by: Jan Michalski <jan.michalski@intel.com>
- Loading branch information
Showing
8 changed files
with
133 additions
and
109 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
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/usr/bin/env bash | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# Copyright 2016-2023, Intel Corporation | ||
|
||
# | ||
# create-testconfig.sh - creates testconfig files for test execution | ||
# | ||
# Note: It dedicates all Device DAX devices found in the system for testing | ||
# purposes. | ||
# | ||
|
||
# This script makes use of the following variables as they are available in | ||
# the environment: | ||
# - OUTPUT_DIR - the directory where the output testconfig.[sh|py] files are | ||
# about to be written to | ||
# - PMEM_FS_DIR - a directory of a PMem-aware file system | ||
# - PMEM_FS_DIR_FORCE_PMEM - set to 1, if MAP_SYNC in the PMEM_FS_DIR filesystem | ||
# will cause an error. Set to 0 otherwise. | ||
# - force_cacheline - set to True to act in accordance with cache line | ||
# granularity. Set to False otherwise. | ||
# - force_byte - set to True to act in accordance with byte granularity. Set to | ||
# False otherwise. | ||
|
||
# input validation | ||
if [ -z "$OUTPUT_DIR" ]; then | ||
echo "OUTPUT_DIR is empty"; | ||
exit 1; | ||
fi | ||
|
||
if [ -z "$PMEM_FS_DIR" ]; then | ||
echo "PMEM_FS_DIR is empty"; | ||
exit 1; | ||
fi | ||
|
||
if [ -z "$PMEM_FS_DIR_FORCE_PMEM" ]; then | ||
echo "PMEM_FS_DIR_FORCE_PMEM is empty"; | ||
exit 1; | ||
fi | ||
|
||
if [ -z "$force_cacheline" ]; then | ||
echo "force_cacheline is empty"; | ||
exit 1; | ||
fi | ||
|
||
if [ -z "$force_byte" ]; then | ||
echo "force_byte is empty"; | ||
exit 1; | ||
fi | ||
|
||
# converts y/n value to True/False value | ||
function ynToTrueFalse() { | ||
[ "$1" = "y" ] && echo "True" || echo "False" | ||
} | ||
|
||
# static values for both Bash and Python | ||
NON_PMEM_FS_DIR=/dev/shm | ||
KEEP_GOING=y | ||
keep_going=$(ynToTrueFalse $KEEP_GOING) | ||
TEST_BUILD="debug nondebug" | ||
build="['debug', 'nondebug']" | ||
TEST_TIMEOUT=120m | ||
ENABLE_SUDO_TESTS=y | ||
enable_admin_tests=$(ynToTrueFalse $ENABLE_SUDO_TESTS) | ||
TM=1 | ||
[ "$TM" = "1" ] && tm=True || tm=False | ||
|
||
# lookup all Device DAX devices in the system | ||
DEVICE_DAX_PATH= | ||
device_dax_path= | ||
if [ `which ndctl` ]; then | ||
DEVICE_DAX_PATH="$(ndctl list -X | jq -r '.[].daxregion.devices[].chardev' | awk '$0="/dev/"$0' | paste -sd' ')" | ||
device_dax_path="$(ndctl list -X | jq -r '.[].daxregion.devices[].chardev' | awk '$0="'\''/dev/"$0"'\''"' | paste -sd',')" | ||
fi | ||
|
||
# generate Bash's test configuration file | ||
cat << EOL > $OUTPUT_DIR/testconfig.sh | ||
NON_PMEM_FS_DIR=$NON_PMEM_FS_DIR | ||
PMEM_FS_DIR=$PMEM_FS_DIR | ||
PMEM_FS_DIR_FORCE_PMEM=$PMEM_FS_DIR_FORCE_PMEM | ||
DEVICE_DAX_PATH=($DEVICE_DAX_PATH) | ||
KEEP_GOING=$KEEP_GOING | ||
TEST_BUILD="$TEST_BUILD" | ||
TEST_TIMEOUT=$TEST_TIMEOUT | ||
ENABLE_SUDO_TESTS=$ENABLE_SUDO_TESTS | ||
TM=$TM | ||
EOL | ||
|
||
# generate Python's test configuration file | ||
cat << EOL > $OUTPUT_DIR/testconfig.py | ||
config = { | ||
'page_fs_dir': '${NON_PMEM_FS_DIR}', | ||
'force_page': False, | ||
'cacheline_fs_dir': '${PMEM_FS_DIR}', | ||
'force_cacheline': $force_cacheline, | ||
'byte_fs_dir': '${PMEM_FS_DIR}', | ||
'force_byte': $force_byte, | ||
'device_dax_path' : [$device_dax_path], | ||
'keep_going': $keep_going, | ||
'build': $build, | ||
'timeout': '$TEST_TIMEOUT', | ||
'enable_admin_tests': $enable_admin_tests, | ||
'tm': $tm, | ||
} | ||
EOL |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.