diff --git a/flow/test/test_make_issue.sh b/flow/test/test_make_issue.sh index 26ab044fb0..6e64f5341c 100755 --- a/flow/test/test_make_issue.sh +++ b/flow/test/test_make_issue.sh @@ -15,13 +15,12 @@ make ISSUE_TAG=tag DESIGN_CONFIG=designs/asap7/gcd/config.mk ${ISSUE_TARGET}_iss test_archive=${ISSUE_TARGET}_tag.tar.gz ls -l $test_archive echo "Testing $test_archive" -runme=$(realpath run-me-gcd-asap7-base.sh) . ../env.sh rm -rf results/make-issue/ mkdir -p results/make-issue/ cd results/make-issue/ tar --strip-components=1 -xzf ../../$test_archive -sed -i 's/openroad -no_init/openroad -exit -no_init/g' $runme -$runme +sed -i 's/openroad -no_init/openroad -exit -no_init/g' run-me-gcd-asap7-base.sh +./run-me-gcd-asap7-base.sh # check for basic syntax errors openroad -exit -no_init vars-gcd-asap7-base.tcl diff --git a/flow/util/generate-vars.sh b/flow/util/generate-vars.sh index 90e9c13e04..54a88852d1 100755 --- a/flow/util/generate-vars.sh +++ b/flow/util/generate-vars.sh @@ -3,6 +3,7 @@ set -euo pipefail DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" FLOW_ROOT=$(realpath "${FLOW_HOME}") ORFS_ROOT=$(realpath "${FLOW_HOME}/../") +WORK_ROOT=$(realpath "${WORK_HOME:-.}") # exclude system and CI variables EXCLUDED_VARS='MAKE|MAKEFLAGS|PERL5LIB|QT_QPA_PLATFORM' @@ -54,6 +55,18 @@ while read -r VAR; do # PII members use PRESERVE_PATHS=1 make issue ... if [[ ! -v PRESERVE_PATHS ]]; then + # Relativize paths under WORK_HOME (e.g. a CI workspace); makeIssue.sh + # stores those files at the tarball root. Both the literal and the + # symlink-resolved form may appear in values. Skip when WORK_HOME is + # FLOW_HOME, which is handled via ${FLOW_HOME} below. + for work_path in "${WORK_HOME:-.}" "${WORK_ROOT}"; do + work_path="${work_path%/}" + if [[ "${work_path}" == /* && "${work_path}" != "${FLOW_ROOT}" ]]; then + # require a path boundary after the match so e.g. /tmp/work + # does not corrupt /tmp/work_other + value=$(sed -e "s,\(^\|[: \"']\)${work_path}\(/\|[: \"']\|$\),\1.\2,g" <<< "${value}") + fi + done for path in workspace platforms; do value=$(sed -e "s,\(^\|[: \"']\)/${path},\1./${path},g" <<< "${value}") done diff --git a/flow/util/makeIssue.sh b/flow/util/makeIssue.sh index bc077dd874..6941a98071 100755 --- a/flow/util/makeIssue.sh +++ b/flow/util/makeIssue.sh @@ -80,17 +80,22 @@ else IS_YOSYS=0 fi +# Source the vars file relative to the run-me script itself, so the +# reproducible works out of the box wherever the tarball is extracted +# (WORK_HOME is an absolute CI path that does not exist elsewhere). if [ "$IS_YOSYS" -eq 1 ]; then cat > ${RUN_ME_SCRIPT} < ${RUN_ME_SCRIPT} <