mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
The earlier version of the installation logic in tests/run-js-test-on-arm.sh always used 'linux-x86' as the architecture tag for the downloaded node.js installation package, which made the tests themselves fail when running on an instance powered by an ARM (Graviton) CPU. This patch uses the $ARCH_NAME environment variable set up in bin/impala-config.sh to add the correct CPU architecture tag to the URL of the node.js package to be downloaded. If the rported CPU type is not one of the known types (x86_64 or aarch64), the installation step throws and error and emits a JUnit XML symptom for Jenkins runs. Change-Id: Ie22da6237ed6d19cf8af721df471033fdfe6b23a Reviewed-on: http://gerrit.cloudera.org:8080/21070 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Reviewed-by: Surya Hebbar <shebbar@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
73 lines
2.6 KiB
Bash
Executable File
73 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing,
|
|
# software distributed under the License is distributed on an
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
# KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
set -euo pipefail
|
|
. "$IMPALA_HOME/bin/report_build_error.sh"
|
|
setup_report_build_error
|
|
|
|
: ${IMPALA_JS_TEST_LOGS_DIR:="${IMPALA_LOGS_DIR}/js_tests"}
|
|
|
|
NODEJS_VERSION=v16.20.2
|
|
# ARCH_NAME is set in bin/impala-config.sh
|
|
if [[ $ARCH_NAME == aarch64 ]]; then
|
|
NODEJS_DISTRO=linux-arm64
|
|
elif [[ $ARCH_NAME == x86_64 ]]; then
|
|
NODEJS_DISTRO=linux-x64
|
|
else
|
|
echo "This script supports Intel x86_64 or ARM aarch64 CPU architectures only." >&2
|
|
echo "Current CPU type is reported as $ARCH_NAME" >&2
|
|
# report the installation failure as a JUnit symptom
|
|
"${IMPALA_HOME}"/bin/generate_junitxml.py --phase JS_TEST \
|
|
-- step "node.js installation" \
|
|
--error "Unknown CPU architecture $ARCH_NAME encountered."
|
|
exit 1
|
|
fi
|
|
|
|
NODEJS_LIB_PATH="${IMPALA_TOOLCHAIN}/node-${NODEJS_VERSION}"
|
|
export IMPALA_NODEJS="${NODEJS_LIB_PATH}/bin/node"
|
|
NPM="${NODEJS_LIB_PATH}/bin/npm"
|
|
JS_TESTS_DIR="${IMPALA_HOME}/www/scripts/tests"
|
|
|
|
export IMPALA_JS_TEST_LOGS_DIR;
|
|
|
|
# Install nodejs locally, if not installed
|
|
if [ -r "$IMPALA_NODEJS" ]; then
|
|
echo "NodeJS ${NODEJS_VERSION} installation found";
|
|
else
|
|
echo "Fetching NodeJS ${NODEJS_VERSION}-${NODEJS_DISTRO} binaries ...";
|
|
NODE_URL_PREFIX="https://nodejs.org/dist"
|
|
NODE_URL_SUFFIX="${NODEJS_VERSION}/node-${NODEJS_VERSION}-${NODEJS_DISTRO}.tar.xz"
|
|
curl "${NODE_URL_PREFIX}/${NODE_URL_SUFFIX}" -O
|
|
|
|
tar -xJf node-${NODEJS_VERSION}-${NODEJS_DISTRO}.tar.xz
|
|
|
|
mkdir -p "${NODEJS_LIB_PATH}"
|
|
|
|
mv node-${NODEJS_VERSION}-${NODEJS_DISTRO}/* -t "${NODEJS_LIB_PATH}";
|
|
|
|
rm -rf node-${NODEJS_VERSION}-${NODEJS_DISTRO}.tar.xz \
|
|
node-${NODEJS_VERSION}-${NODEJS_DISTRO}/
|
|
fi;
|
|
|
|
# Install packages in package.json
|
|
"$IMPALA_NODEJS" "$NPM" --prefix "${JS_TESTS_DIR}" install
|
|
|
|
# Run all JEST testing suites (by default *.test.js)
|
|
"$IMPALA_NODEJS" "$NPM" --prefix "${JS_TESTS_DIR}" test
|