From 439c0252b5786b416584acc32b10f073f89f6b89 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Mon, 3 Nov 2025 10:59:58 +0100 Subject: [PATCH] [circle-mlir] Discard output from the cd command when followed by pwd This commits fixes the issue when `cd` is followed by the `pwd` in a bash one-liner which should get the directory in which the executed script is located. The problem with such approach is that the `cd` command can print the destination directory in case when one has the CDPATH environmental variable set. ONE-DCO-1.0-Signed-off-by: Arkadiusz Bokowy --- .../tools-test/circle-impexp-test/run_import_test.sh | 2 +- .../tools-test/circle-impexp-test/run_value_test.sh | 2 +- circle-mlir/circle-mlir/tools-test/gen-onnx/run_gen_onnx.sh | 2 +- .../onnx2circle-rewrite-test/run_circle_ops_test.sh | 2 +- .../tools-test/onnx2circle-value-test/run_value_test.sh | 2 +- circle-mlir/infra/overlay/prepare-venv | 2 +- circle-mlir/infra/tools/gen-coverage-report | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/circle-mlir/circle-mlir/tools-test/circle-impexp-test/run_import_test.sh b/circle-mlir/circle-mlir/tools-test/circle-impexp-test/run_import_test.sh index acf91ce1398..bdfe6a3aba6 100644 --- a/circle-mlir/circle-mlir/tools-test/circle-impexp-test/run_import_test.sh +++ b/circle-mlir/circle-mlir/tools-test/circle-impexp-test/run_import_test.sh @@ -10,7 +10,7 @@ set -e -TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" MODEL_NAME="$1"; shift diff --git a/circle-mlir/circle-mlir/tools-test/circle-impexp-test/run_value_test.sh b/circle-mlir/circle-mlir/tools-test/circle-impexp-test/run_value_test.sh index 7794abbc226..d0f55fd5d72 100644 --- a/circle-mlir/circle-mlir/tools-test/circle-impexp-test/run_value_test.sh +++ b/circle-mlir/circle-mlir/tools-test/circle-impexp-test/run_value_test.sh @@ -12,7 +12,7 @@ set -e -TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" VENV_PATH="$1"; shift MODEL_NAME="$1"; shift diff --git a/circle-mlir/circle-mlir/tools-test/gen-onnx/run_gen_onnx.sh b/circle-mlir/circle-mlir/tools-test/gen-onnx/run_gen_onnx.sh index 434d45a25b4..72cf33187c2 100644 --- a/circle-mlir/circle-mlir/tools-test/gen-onnx/run_gen_onnx.sh +++ b/circle-mlir/circle-mlir/tools-test/gen-onnx/run_gen_onnx.sh @@ -10,7 +10,7 @@ # model_name : name of model # onnx_name : name of onnx file -THIS_SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +THIS_SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" PY_SCRIPT_PATH="${THIS_SCRIPT_PATH}/run_gen_onnx.py" VENV_PATH="$1"; shift diff --git a/circle-mlir/circle-mlir/tools-test/onnx2circle-rewrite-test/run_circle_ops_test.sh b/circle-mlir/circle-mlir/tools-test/onnx2circle-rewrite-test/run_circle_ops_test.sh index c6d89450b79..94fc8bf8ce7 100644 --- a/circle-mlir/circle-mlir/tools-test/onnx2circle-rewrite-test/run_circle_ops_test.sh +++ b/circle-mlir/circle-mlir/tools-test/onnx2circle-rewrite-test/run_circle_ops_test.sh @@ -10,7 +10,7 @@ set -e -TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" VENV_PATH="$1"; shift RUN_PATH="$1"; shift diff --git a/circle-mlir/circle-mlir/tools-test/onnx2circle-value-test/run_value_test.sh b/circle-mlir/circle-mlir/tools-test/onnx2circle-value-test/run_value_test.sh index 9d5a44eccf6..30cf6707a8d 100644 --- a/circle-mlir/circle-mlir/tools-test/onnx2circle-value-test/run_value_test.sh +++ b/circle-mlir/circle-mlir/tools-test/onnx2circle-value-test/run_value_test.sh @@ -13,7 +13,7 @@ set -e -TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" VENV_PATH="$1"; shift MODEL_NAME="$1"; shift diff --git a/circle-mlir/infra/overlay/prepare-venv b/circle-mlir/infra/overlay/prepare-venv index da5f5f7e249..6d813063e8a 100644 --- a/circle-mlir/infra/overlay/prepare-venv +++ b/circle-mlir/infra/overlay/prepare-venv @@ -34,7 +34,7 @@ fi set -e -DRIVER_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +DRIVER_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" if [[ -z "$VENV_NAME" ]]; then VENV_NAME="venv" fi diff --git a/circle-mlir/infra/tools/gen-coverage-report b/circle-mlir/infra/tools/gen-coverage-report index 8d120dd0ba0..5c770dc02ec 100644 --- a/circle-mlir/infra/tools/gen-coverage-report +++ b/circle-mlir/infra/tools/gen-coverage-report @@ -1,12 +1,12 @@ #!/bin/bash # Environment variables to override -# COVERAGE_RPATH : folder where coverage report is generatged, +# COVERAGE_RPATH : folder where coverage report is generated, # default is 'coverage' # COVERAGE_PATH : path where coverage report is generated, # default is ${PROJECT_PATH}/${COVERAGE_RPATH} -PROJECT_PATH="$(cd $(dirname ${BASH_SOURCE[0]})/../.. && pwd)" +PROJECT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null && pwd)" # Set BUILD_WORKSPACE_RPATH with default 'build/coverage' if not set BUILD_WORKSPACE_RPATH="${BUILD_WORKSPACE_RPATH:-build/coverage}"