Skip to content

Commit

Permalink
Revert to test.sh script while test.py tweaks are being resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
Jpnock committed Feb 7, 2024
1 parent 991fb08 commit 5d02258
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
#!/bin/bash

# If Python does not work, run scripts/ to test

if ! command -v python3 &> /dev/null; then
echo "Python is not installed. Installing Python..."
sudo apt-get update
sudo apt-get install python3 -y
fi

. scripts/test.py
. scripts/test.sh

This comment has been minimized.

Copy link
@SanjitRaman

SanjitRaman Feb 7, 2024

Contributor

Still missing the "/"??

This comment has been minimized.

Copy link
@Jpnock

Jpnock Feb 7, 2024

Author Collaborator

Yes, this is legal. The . operator sources the script into the current interpreter environment.

Does this not work on your system?

If so, can you provide the output when you run ./test.sh

This comment has been minimized.

Copy link
@Jpnock

Jpnock Feb 7, 2024

Author Collaborator

Note that it previously didn't work when it was . scripts/test.py since that would try to source python code into a bash interpreter

This comment has been minimized.

Copy link
@SanjitRaman

SanjitRaman Feb 7, 2024

Contributor

I see, yes, this works for me. I can see why it was previously written as . scripts/test.py, however I get the following output (before you reverted it: 991fb08)

. scripts/test.py
bash: 
A wrapper script to run all the compiler tests. This script will call the
Makefile, run the tests and store the outputs in bin/output.

This script will also generate a JUnit XML file, which can be used to integrate
with CI/CD pipelines.

Usage: test.py [-h] [-m] [-v] [--version] [dir]

Example usage: scripts/test.py compiler_tests/_example

This will print out a progress bar and only run the example tests.
The output would be placed into bin/output/_example/example/.

For more information, run scripts/test.py -h
: No such file or directory
__version__: command not found
__author__: command not found
Command 'import' not found, but can be installed with:
sudo apt install graphicsmagick-imagemagick-compat  # version 1.4+really1.3.38-1ubuntu0.1, or
sudo apt install imagemagick-6.q16                  # version 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3
sudo apt install imagemagick-6.q16hdri              # version 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3
Command 'import' not found, but can be installed with:
sudo apt install graphicsmagick-imagemagick-compat  # version 1.4+really1.3.38-1ubuntu0.1, or
sudo apt install imagemagick-6.q16                  # version 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3
sudo apt install imagemagick-6.q16hdri              # version 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3
Command 'import' not found, but can be installed with:
sudo apt install graphicsmagick-imagemagick-compat  # version 1.4+really1.3.38-1ubuntu0.1, or
sudo apt install imagemagick-6.q16                  # version 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3
sudo apt install imagemagick-6.q16hdri              # version 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3
Command 'import' not found, but can be installed with:
sudo apt install graphicsmagick-imagemagick-compat  # version 1.4+really1.3.38-1ubuntu0.1, or
sudo apt install imagemagick-6.q16                  # version 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3
sudo apt install imagemagick-6.q16hdri              # version 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3
Command 'import' not found, but can be installed with:
sudo apt install graphicsmagick-imagemagick-compat  # version 1.4+really1.3.38-1ubuntu0.1, or
sudo apt install imagemagick-6.q16                  # version 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3
sudo apt install imagemagick-6.q16hdri              # version 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3
Command 'from' not found, but can be installed with:
sudo apt install mailutils
Command 'from' not found, but can be installed with:
sudo apt install mailutils
bash: scripts/test.py: line 35: syntax error near unexpected token `('
bash: scripts/test.py: line 35: `SCRIPT_LOCATION = Path(__file__).resolve().parent'

This comment has been minimized.

Copy link
@Jpnock

Jpnock Feb 7, 2024

Author Collaborator

Yeah it was a bad merge commit, where .sh was changed to .py without considering what the . operator does (trying to interpret python as bash code in this case)

The line you suggested ./scripts/test.py would get the python script to run but wouldn't pass arguments such as -v to the python script (which works with the . operator). PR #9 also makes modifications to this file and other fixes to the python script, so I've reverted to the bash script until all regressions are fixed.

Hope that explains it : )

This comment has been minimized.

Copy link
@SanjitRaman

SanjitRaman Feb 7, 2024

Contributor

Ok, thanks -- look forward to seeing #9 merged :)

0 comments on commit 5d02258

Please sign in to comment.