Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: add download testing #14363

Closed
wants to merge 1 commit into from
Closed
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
27 changes: 27 additions & 0 deletions tools/download-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

if [ -z ${NODE_VERSION} ]; then
echo "NODE_VERSION is undefined! Please declare NODE_VERSION"
exit 1
fi
# Remove old files
rm -r nodejs.org || true

# Scrape the download server
wget -r --no-parent http://nodejs.org/dist/v${NODE_VERSION}/

cat nodejs.org/dist/v${NODE_VERSION}/SHASUMS256.txt | while read line
do
sha=$(echo "${line}" | awk '{print $1}')
file=$(echo "${line}" | awk '{print $2}')
echo "Checking shasum for $file"
remoteSHA=$(shasum -a 256 "nodejs.org/dist/v${NODE_VERSION}/${file}" | awk '{print $1}')
if [ ${remoteSHA} != ${sha} ]; then
echo "Error - SHASUMS256 does not match for ${file}"
echo "Expected - ${sha}"
echo "Found - ${remoteSHA}"
return 1
else
echo "Pass - SHASUMS256 for ${file} is correct"
fi
done