Skip to content

Commit

Permalink
Update handling of subdirectory creation (#328)
Browse files Browse the repository at this point in the history
* Update handling of subdirectory creation

* Add conditional statement to only source `nvm` when running locally

* Another attempt at fixing the installation of nvm

* Fix bash syntax for conditional test

* Fix bash conditional test logic

* Set NVM_DIR conditionally based on style (version?) of installation used

* Typo

* Remove redundant hardcoded env var for NVM_DIR

* Add steps from NVM Readme installation section on loading NVM

---------

Co-authored-by: Elango Cheran <[email protected]>
  • Loading branch information
sven-oly and echeran authored Oct 10, 2024
1 parent ee6d46e commit 6e14027
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
16 changes: 12 additions & 4 deletions generateDataAndRun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@ then
fi

# Enable seting the version of NodeJS
export NVM_DIR=$HOME/.nvm;
# Install NVM if it is not install in CI

if [[ $CI == "true" ]] && ! [ -x "$(command -v nvm)" ]
then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="$HOME/.config/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
else
export NVM_DIR=$HOME/.nvm
fi

source $NVM_DIR/nvm.sh;

##########
Expand Down Expand Up @@ -102,9 +113,6 @@ mkdir -p $TEMP_DIR/testOutput
# Change to directory of `testdriver` (which will be used to invoke each platform executor)
pushd testdriver

# Set to use NVM
source "$HOME/.nvm/nvm.sh"

# Invoke all tests
jq -c '.[]' ../$source_file | while read i; do
if jq -e 'has("prereq")' <<< $i > /dev/null
Expand Down
6 changes: 2 additions & 4 deletions testdriver/testplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,9 @@ def run_one_test_mode(self):
try:
result_dir = os.path.dirname(self.outputFilePath)
if not os.path.isdir(result_dir):
os.makedirs(result_dir)
os.makedirs(result_dir, exist_ok=True)
except BaseException as error:
sys.stderr.write('!!!%s: Cannot create directory %sfor report file %s' %
(error, result_dir, self.outputFilePath))
return None
logging.error('testplay.py: %s for %s / %s', error, result_dir, self.outputFilePath)

# Create results file
try:
Expand Down
2 changes: 1 addition & 1 deletion verifier/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def open_verify_files(self, vplan):
vplan.result_time_stamp = datetime.datetime.fromtimestamp(file_time).strftime('%Y-%m-%d %H:%M')
vplan.report.timestamp = vplan.result_time_stamp
except BaseException as err:
logging.error(' *** Cannot open results file %s:\n %s', vplan.result_path, err)
logging.error(' *** CANNOT OPEN RESULTS FILE %s:\n %s', vplan.result_path, err)
return None

try:
Expand Down

0 comments on commit 6e14027

Please sign in to comment.