diff --git a/CHANGES.md b/CHANGES.md index a8a232d61..3c390680b 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 f2fc4a15a..2aefd5589 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