Skip to content

Commit

Permalink
flow: test: test_helper.sh: Add 'simulate power' test
Browse files Browse the repository at this point in the history
Expands the test helper script with 'simulate power' target if present.

Quotes expressions to avoid word splitting.

Signed-off-by: Illia Vysochyn <[email protected]>
  • Loading branch information
ivysochyn authored and eszpotanski committed Aug 14, 2024
1 parent ee899c3 commit 64e9ba4
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions flow/test/test_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eoux pipefail

cd "$(dirname $(readlink -f $0))/../"
cd "$(dirname "$(readlink -f "$0")")/../"

# Setting args (and setting default values for testing)
DESIGN_NAME=${1:-gcd}
Expand All @@ -12,21 +12,22 @@ if [ $# -eq 4 ]; then
FLOW_VARIANT=$4
fi
DESIGN_CONFIG=./designs/$PLATFORM/$DESIGN_NAME/$CONFIG_MK
POWER_TCL_FILE=./designs/$PLATFORM/$DESIGN_NAME/power.tcl
LOG_FILE=./logs/$PLATFORM/$DESIGN_NAME.log
mkdir -p ./logs/$PLATFORM
mkdir -p "./logs/$PLATFORM"

__make="make DESIGN_CONFIG=$DESIGN_CONFIG"
if [ ! -z "${FLOW_VARIANT+x}" ]; then
if [ -n "${FLOW_VARIANT+x}" ]; then
__make+=" FLOW_VARIANT=$FLOW_VARIANT"
fi

mkdir -p $(dirname $LOG_FILE)
$__make clean_all clean_metadata 2>&1 | tee $LOG_FILE
mkdir -p "$(dirname "$LOG_FILE")"
$__make clean_all clean_metadata 2>&1 | tee "$LOG_FILE"

# turn off abort on error so we can always capture the result
set +e

$__make finish metadata 2>&1 | tee -a $LOG_FILE
$__make finish metadata 2>&1 | tee -a "$LOG_FILE"

# Save the return code to return as the overall status after we package
# the results
Expand All @@ -36,21 +37,21 @@ if [ -z "${PRIVATE_DIR+x}" ]; then
PRIVATE_DIR="../../private_tool_scripts"
fi

if [ -f "$PRIVATE_DIR/openRoad/private.mk" ] && [ ! -z ${SAVE_TO_DB+x} ]; then
if [ -f "$PRIVATE_DIR/openRoad/private.mk" ] && [ -n "${SAVE_TO_DB+x}" ]; then
$__make save_to_metrics_db
ret=$(( ret + $? ))
fi

if [ -f "$PRIVATE_DIR/util/utils.mk" ] && [ ! -z ${RUN_CALIBRE+x} ]; then
if [ -f "$PRIVATE_DIR/util/utils.mk" ] && [ -n "${RUN_CALIBRE+x}" ]; then
$__make calibre_drc
ret=$(( ret + $? ))
$__make convert_calibre
ret=$(( ret + $? ))
if [ ! -z ${SAVE_TO_DB+x} ]; then
if [ -n "${SAVE_TO_DB+x}" ]; then
$__make save_to_drc_db
ret=$(( ret + $? ))
fi
if [ ! -z ${CHECK_DRC_DB+x} ]; then
if [ -n "${CHECK_DRC_DB+x}" ]; then
$__make check_drc_db
ret=$(( ret + $? ))
fi
Expand All @@ -59,8 +60,13 @@ fi
# Only enabled abort on error at the end to allow script to reach make issue
set -e

if [ ! -z ${MAKE_ISSUE+x} ]; then
$__make final_report_issue 2>&1 | tee -a $LOG_FILE
if [ -n "${MAKE_ISSUE+x}" ]; then
$__make final_report_issue 2>&1 | tee -a "$LOG_FILE"
fi

if [ $ret -eq 0 ] && [ -f "$POWER_TCL_FILE" ]; then
$__make simulate power 2>&1 | tee -a "$LOG_FILE"
ret=$?
fi

exit $ret

0 comments on commit 64e9ba4

Please sign in to comment.