From d14148d42e2a225986fa76be3e8b60f73f0ac4af Mon Sep 17 00:00:00 2001 From: wallezhang Date: Wed, 19 May 2021 13:13:29 +0800 Subject: [PATCH] fix: Fix macos test script command not found error. #6846 (#6964) Co-authored-by: Zhenxu Ke --- CHANGES.md | 1 + test/plugin/run.sh | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a8a232d61d..3c390680bf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ Release Notes. #### Project * Add OpenSearch as storage option. * Upgrade Kubernetes Java client dependency to 11.0. +* Fix plugin test script error in macOS. #### Java Agent * Add `trace_segment_ref_limit_per_span` configuration mechanism to avoid OOM. diff --git a/test/plugin/run.sh b/test/plugin/run.sh index f2fc4a15ab..2aefd55891 100755 --- a/test/plugin/run.sh +++ b/test/plugin/run.sh @@ -33,6 +33,8 @@ num_of_testcases= image_version="jdk8-1.0.0" jacoco_version="${JACOCO_VERSION:-0.8.6}" +os="$(uname)" + print_help() { echo "Usage: run.sh [OPTION] SCENARIO_NAME" echo -e "\t-f, --force_build \t\t do force to build Plugin-Test tools and images" @@ -142,10 +144,18 @@ if [[ ! -d ${agent_home} ]]; then ${mvnw} --batch-mode -f ${home}/../../pom.xml -Pagent -DskipTests clean package fi # if it fails last time, relevant information will be deleted -sed -i '/scenarios\/'"$scenario_name"'<\/sourceDirectory>/d' ./pom.xml +if [ "$os" == 'Darwin' ]; then + sed -i '' '/scenarios\/'"$scenario_name"'<\/sourceDirectory>/d' ./pom.xml +else + sed -i '/scenarios\/'"$scenario_name"'<\/sourceDirectory>/d' ./pom.xml +fi # add scenario_name into plugin/pom.xml echo check code with the checkstyle-plugin -sed -i '/<\/sourceDirectories>/i scenarios\/'"$scenario_name"'<\/sourceDirectory>' ./pom.xml +if [ "$os" == 'Darwin' ]; then + sed -i '' '/<\/sourceDirectories>/i\'$'\n''scenarios\/'"$scenario_name"'<\/sourceDirectory>'$'\n' ./pom.xml +else + sed -i '/<\/sourceDirectories>/i scenarios\/'"$scenario_name"'<\/sourceDirectory>' ./pom.xml +fi if [[ "$force_build" == "on" ]]; then profile= @@ -153,7 +163,11 @@ if [[ "$force_build" == "on" ]]; then ${mvnw} --batch-mode -f ${home}/pom.xml clean package -DskipTests ${profile} fi # remove scenario_name into plugin/pom.xml -sed -i '/scenarios\/'"$scenario_name"'<\/sourceDirectory>/d' ./pom.xml +if [ "$os" == 'Darwin' ]; then + sed -i '' '/scenarios\/'"$scenario_name"'<\/sourceDirectory>/d' ./pom.xml +else + sed -i '/scenarios\/'"$scenario_name"'<\/sourceDirectory>/d' ./pom.xml +fi workspace="${home}/workspace/${scenario_name}" [[ -d ${workspace} ]] && rm -rf $workspace