Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions plain2code.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ def run_render():
def main(): # noqa: C901
args = parse_arguments()

# Anchor all relative paths to the plain file's directory.
# Resolve filename to absolute first (it may be relative to the original CWD),
# then change CWD so that all subsequent relative paths (build_folder, etc.) resolve correctly.
args.filename = os.path.abspath(args.filename)
os.chdir(os.path.dirname(args.filename))

# Handle early-exit flags before heavy initialization
if args.dry_run or args.full_plain:
template_dirs = file_utils.get_template_directories(args.filename, args.template_dir, DEFAULT_TEMPLATE_DIRS)
Expand Down
13 changes: 4 additions & 9 deletions test_scripts/run_conformance_tests_cypress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,12 @@ if [[ "$3" == "-v" || "$3" == "--verbose" ]]; then
VERBOSE=1
fi

current_dir=$(pwd)

# Ensures that if any command in the pipeline fails (like npm run build), the entire pipeline
# will return a non-zero status, allowing the if condition to properly catch failures.
set -o pipefail

# Define the path to the subfolder
NODE_SUBFOLDER=node_$1
NODE_SUBFOLDER=$(dirname "$1")/node_$(basename "$1")

# Running React application
printf "### Step 1: Starting the React application in folder $NODE_SUBFOLDER...\n"
Expand All @@ -121,7 +119,7 @@ else
mkdir -p $NODE_SUBFOLDER
fi

cp -R $1/* $NODE_SUBFOLDER
cp -R "$1"/* $NODE_SUBFOLDER

# Move to the subfolder
cd "$NODE_SUBFOLDER" 2>/dev/null
Expand Down Expand Up @@ -202,11 +200,8 @@ fi
# Execute all Cypress conformance tests in the build folder
printf "### Step 2: Running Cypress conformance tests $2...\n"

# Move back to the original directory
cd $current_dir

# Define the path to the conformance tests subfolder
NODE_CONFORMANCE_TESTS_SUBFOLDER=node_$2
NODE_CONFORMANCE_TESTS_SUBFOLDER=$(dirname "$2")/node_$(basename "$2")

if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
printf "Preparing conformance tests Node subfolder: $NODE_CONFORMANCE_TESTS_SUBFOLDER\n"
Expand All @@ -228,7 +223,7 @@ else
mkdir -p $NODE_CONFORMANCE_TESTS_SUBFOLDER
fi

cp -R $2/* $NODE_CONFORMANCE_TESTS_SUBFOLDER
cp -R "$2"/* $NODE_CONFORMANCE_TESTS_SUBFOLDER

# Move to the subfolder with Cypress tests
cd "$NODE_CONFORMANCE_TESTS_SUBFOLDER" 2>/dev/null
Expand Down
14 changes: 6 additions & 8 deletions test_scripts/run_conformance_tests_golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ if [ -z "$2" ]; then
exit $UNRECOVERABLE_ERROR_EXIT_CODE
fi

current_dir=$(pwd)

GO_BUILD_SUBFOLDER=go_$1
GO_BUILD_SUBFOLDER=$(dirname "$1")/go_$(basename "$1")

if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
printf "Preparing Go build subfolder: $GO_BUILD_SUBFOLDER\n"
Expand All @@ -40,7 +38,7 @@ else
mkdir -p $GO_BUILD_SUBFOLDER
fi

cp -R $1/* $GO_BUILD_SUBFOLDER
cp -R "$1"/* $GO_BUILD_SUBFOLDER

# Move to the subfolder
cd "$GO_BUILD_SUBFOLDER" 2>/dev/null
Expand All @@ -53,10 +51,10 @@ fi
echo "Runinng go get in the build folder..."
go get

cd "$current_dir/$2" 2>/dev/null
cd "$2" 2>/dev/null

if [ $? -ne 0 ]; then
printf "Error: Conformance tests folder '$current_dir/$2' does not exist.\n"
printf "Error: Conformance tests folder '$2' does not exist.\n"
exit $UNRECOVERABLE_ERROR_EXIT_CODE
fi

Expand All @@ -69,12 +67,12 @@ else
fi

# Move back to build directory
cd "$current_dir/$GO_BUILD_SUBFOLDER" 2>/dev/null
cd "$GO_BUILD_SUBFOLDER" 2>/dev/null

# Execute Go lang conformance tests
printf "Running Golang conformance tests...\n\n"

output=$(go run $current_dir/$2/conformance_tests.go 2>&1)
output=$(go run "$2"/conformance_tests.go 2>&1)
exit_code=$?

# If there was an error, print the output and exit with the error code
Expand Down
8 changes: 3 additions & 5 deletions test_scripts/run_conformance_tests_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ else
exit $UNRECOVERABLE_ERROR_EXIT_CODE
fi

current_dir=$(pwd)

PYTHON_BUILD_SUBFOLDER=python_$1
PYTHON_BUILD_SUBFOLDER=$(dirname "$1")/python_$(basename "$1")

if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
printf "Preparing Python build subfolder: $PYTHON_BUILD_SUBFOLDER\n"
Expand All @@ -50,7 +48,7 @@ else
mkdir -p $PYTHON_BUILD_SUBFOLDER
fi

cp -R $1/* $PYTHON_BUILD_SUBFOLDER
cp -R "$1"/* $PYTHON_BUILD_SUBFOLDER

# Move to the subfolder
cd "$PYTHON_BUILD_SUBFOLDER" 2>/dev/null
Expand All @@ -63,7 +61,7 @@ fi
# Execute all Python conformance tests in the build folder
printf "Running Python conformance tests...\n\n"

output=$($PYTHON_CMD -m unittest discover -b -s "$current_dir/$2" 2>&1)
output=$($PYTHON_CMD -m unittest discover -b -s "$2" 2>&1)
exit_code=$?

# Echo the original output
Expand Down
4 changes: 2 additions & 2 deletions test_scripts/run_unittests_golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ -z "$1" ]; then
exit $UNRECOVERABLE_ERROR_EXIT_CODE
fi

GO_BUILD_SUBFOLDER=go_$1
GO_BUILD_SUBFOLDER=$(dirname "$1")/go_$(basename "$1")

if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
printf "Preparing Go build subfolder: $GO_BUILD_SUBFOLDER\n"
Expand All @@ -31,7 +31,7 @@ else
mkdir -p $GO_BUILD_SUBFOLDER
fi

cp -R $1/* $GO_BUILD_SUBFOLDER
cp -R "$1"/* $GO_BUILD_SUBFOLDER

# Move to the subfolder
cd "$GO_BUILD_SUBFOLDER" 2>/dev/null
Expand Down
4 changes: 2 additions & 2 deletions test_scripts/run_unittests_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ else
exit $UNRECOVERABLE_ERROR_EXIT_CODE
fi

PYTHON_BUILD_SUBFOLDER=python_$1
PYTHON_BUILD_SUBFOLDER=$(dirname "$1")/python_$(basename "$1")

if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
printf "Preparing Python build subfolder: $PYTHON_BUILD_SUBFOLDER\n"
Expand All @@ -41,7 +41,7 @@ else
mkdir -p $PYTHON_BUILD_SUBFOLDER
fi

cp -R $1/* $PYTHON_BUILD_SUBFOLDER
cp -R "$1"/* $PYTHON_BUILD_SUBFOLDER

# Move to the subfolder
cd "$PYTHON_BUILD_SUBFOLDER" 2>/dev/null
Expand Down
4 changes: 2 additions & 2 deletions test_scripts/run_unittests_react.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ -z "$1" ]; then
fi

# Define the path to the subfolder
NODE_SUBFOLDER=node_$1
NODE_SUBFOLDER=$(dirname "$1")/node_$(basename "$1")

if [ "${VERBOSE:-}" -eq 1 ] 2>/dev/null; then
printf "Preparing Node subfolder: $NODE_SUBFOLDER\n"
Expand All @@ -39,7 +39,7 @@ else
mkdir -p $NODE_SUBFOLDER
fi

cp -R $1/* $NODE_SUBFOLDER
cp -R "$1"/* $NODE_SUBFOLDER

# Move to the subfolder
cd "$NODE_SUBFOLDER" 2>/dev/null
Expand Down
Loading