Skip to content
Merged
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
4 changes: 2 additions & 2 deletions genData100.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ logrotate -s logrotate.state logrotate.conf
##########

export NVM_DIR=$HOME/.nvm;
source $NVM_DIR/nvm.sh;
. $NVM_DIR/nvm.sh;

export RUSTUP_TOOLCHAIN=1.83

Expand Down Expand Up @@ -105,7 +105,7 @@ echo "Created $TEMP_DIR/testOutput"
pushd testdriver

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

echo "RUNNING FROM $source_file"

Expand Down
2 changes: 1 addition & 1 deletion generateDataAndRun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ logrotate -s logrotate.state logrotate.conf
sleep 30
done) &
MONITOR_PID=$!
trap 'kill $MONITOR_PID 2>/dev/null' EXIT
trap 'kill $MONITOR_PID 2>/dev/null || true' EXIT

##########
# Setup (generate) test data & expected values
Expand Down
4 changes: 2 additions & 2 deletions testgen/generators/datetime_fmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def generate_datetime_data_from_cldr(self, dt_json_path, run_limit=-1):
self.saveJsonFile(dt_test_path, test_obj, indent=2)
self.saveJsonFile(dt_verify_path, verify_obj, indent=2)
except BaseException as err:
logging.error('!!! %s: Failure to save file %s', err, )
logging.error('!!! %s: Failure to save files: %s and %s', err, dt_test_path, dt_verify_path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using logging.exception is preferred over logging.error when logging from within an except block. It automatically captures and logs the traceback, which is extremely helpful for debugging failures in CI.

Suggested change
logging.error('!!! %s: Failure to save files: %s and %s', err, dt_test_path, dt_verify_path)
logging.exception('Failure to save files: %s and %s', dt_test_path, dt_verify_path)

return None

def process_test_data(self):
Expand Down Expand Up @@ -164,7 +164,7 @@ def process_test_data(self):
# Set up Node version and call the generator
# Add temporal to the package.
nvm_version = icu_nvm_versions[self.icu_version]
generate_command = 'source ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; npm ci; node generators/datetime_gen.js %s %s' % (
generate_command = '. ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; npm ci; node generators/datetime_gen.js %s %s' % (
nvm_version, nvm_version, '-run_limit', self.run_limit)
Comment on lines +167 to 168

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of hardcoding ~/.nvm/nvm.sh, use the NVM_DIR environment variable (with a fallback to ~/.nvm). In CI, NVM_DIR is configured to $HOME/.config/nvm (see generateDataAndRun.sh line 56), so hardcoding ~/.nvm/nvm.sh will fail to locate NVM.

Suggested change
generate_command = '. ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; npm ci; node generators/datetime_gen.js %s %s' % (
nvm_version, nvm_version, '-run_limit', self.run_limit)
generate_command = '. "${NVM_DIR:-$HOME/.nvm}/nvm.sh"; nvm install %s; nvm use %s --silent; npm ci; node generators/datetime_gen.js %s %s' % (
nvm_version, nvm_version, '-run_limit', self.run_limit)


result = subprocess.run(generate_command, shell=True)
Comment on lines 166 to 170
Expand Down
4 changes: 2 additions & 2 deletions testgen/generators/list_fmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def process_test_data(self):

# Set up Node version and call the generator
nvm_version = icu_nvm_versions[self.icu_version]
generate_command = 'source ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; %s' %\
generate_command = '. ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; %s' %\
(nvm_version, nvm_version, ' '.join(exec_list))
Comment on lines +37 to 38

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of hardcoding ~/.nvm/nvm.sh, use the NVM_DIR environment variable (with a fallback to ~/.nvm) to support custom NVM installation paths (such as $HOME/.config/nvm used in CI).

Suggested change
generate_command = '. ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; %s' %\
(nvm_version, nvm_version, ' '.join(exec_list))
generate_command = '. "${NVM_DIR:-$HOME/.nvm}/nvm.sh"; nvm install %s; nvm use %s --silent; %s' %\
(nvm_version, nvm_version, ' '.join(exec_list))


logging.debug('Running this command: %s', generate_command)
result = result = subprocess.run(generate_command, shell=True)
result = subprocess.run(generate_command, shell=True)
Comment on lines +37 to +41

# Move results to the right directory
mv_command = 'mv list_fmt*.json %s' % self.icu_version
Expand Down
2 changes: 1 addition & 1 deletion testgen/generators/message_fmt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def process_test_data(self):
try:
validate(src_data, json_schema)
except ValidationError as err:
logging.error("Problem validating JSON: %s against schema",
logging.error("Problem validating JSON: %s against schema %s",
test_file_path, json_schema_path)
logging.error(err)

Expand Down
6 changes: 1 addition & 5 deletions testgen/generators/relativedatetime_fmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ def process_test_data(self):
exec_list.append(str(self.run_limit))
exec_command = ' '.join(exec_list)

nodejs_version = icu_nvm_versions[self.icu_version]
source_command = 'source ~/.nvm/nvm.sh; nvm run %s; %s' % (
nodejs_version, exec_command)

if self.icu_version not in icu_nvm_versions:
logging.warning('Generating relative date/time data not configured for icu version %s', self.icu_version)
return False
Expand All @@ -47,7 +43,7 @@ def process_test_data(self):

# Set up Node version and call the generator
nvm_version = icu_nvm_versions[self.icu_version]
generate_command = 'source ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; %s' %\
generate_command = '. ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; %s' %\
(nvm_version, nvm_version, ' '.join(exec_list))
Comment on lines +46 to 47

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of hardcoding ~/.nvm/nvm.sh, use the NVM_DIR environment variable (with a fallback to ~/.nvm) to support custom NVM installation paths (such as $HOME/.config/nvm used in CI).

Suggested change
generate_command = '. ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; %s' %\
(nvm_version, nvm_version, ' '.join(exec_list))
generate_command = '. "${NVM_DIR:-$HOME/.nvm}/nvm.sh"; nvm install %s; nvm use %s --silent; %s' %\
(nvm_version, nvm_version, ' '.join(exec_list))


result = subprocess.run(generate_command, shell=True)
Comment on lines 45 to 49
Expand Down
2 changes: 1 addition & 1 deletion testgen/generators/segmenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def process_test_data(self):

# Set up Node version and call the generator
nvm_version = icu_nvm_versions[self.icu_version]
generate_command = 'source ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; %s' %\
generate_command = '. ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; %s' %\
(nvm_version, nvm_version, ' '.join(exec_list))
Comment on lines +38 to 39

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Instead of hardcoding ~/.nvm/nvm.sh, use the NVM_DIR environment variable (with a fallback to ~/.nvm) to support custom NVM installation paths (such as $HOME/.config/nvm used in CI).

Suggested change
generate_command = '. ~/.nvm/nvm.sh; nvm install %s; nvm use %s --silent; %s' %\
(nvm_version, nvm_version, ' '.join(exec_list))
generate_command = '. "${NVM_DIR:-$HOME/.nvm}/nvm.sh"; nvm install %s; nvm use %s --silent; %s' %\
(nvm_version, nvm_version, ' '.join(exec_list))


logging.debug('Running this command: %s', generate_command)
Expand Down
Loading