From 67a624376c38d16301b15785f4d4c7d4b3b45804 Mon Sep 17 00:00:00 2001 From: Sophia Guo Date: Wed, 11 Dec 2024 10:54:10 -0500 Subject: [PATCH 1/3] result Signed-off-by: Sophia Guo --- settings.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/settings.mk b/settings.mk index 268db9f6..b2341c28 100644 --- a/settings.mk +++ b/settings.mk @@ -449,3 +449,7 @@ resultsSummary: @$(ECHO) $(Q)All tests finished, run result summary:$(Q) $(CD) $(Q)$(TEST_ROOT)$(D)TKG$(D)scripts$(Q); \ perl $(Q)resultsSum.pl$(Q) --failuremk=$(Q)$(FAILEDTARGETS)$(Q) --resultFile=$(Q)$(TEMPRESULTFILE)$(Q) --platFile=$(Q)$(PLATFROMFILE)$(Q) --diagnostic=$(DIAGNOSTICLEVEL) --jdkVersion=$(JDK_VERSION) --jdkImpl=$(JDK_IMPL) --jdkVendor=$(Q)$(JDK_VENDOR)$(Q) --spec=$(SPEC) --buildList=$(BUILD_LIST) --customTarget=$(Q)$(CUSTOM_TARGET)$(Q) --testTarget=$(TESTTARGET) --tapPath=$(TESTOUTPUT)$(D) --tapName=$(TAP_NAME) --comment=$(Q)$(RESULT_COMMENT)$(Q) + +shaInfor: + $(CD) $(Q)$(TEST_ROOT)$(D)TKG$(D)scripts$(Q); \ + bash $(Q)getSHA.sh$(Q) --repo_dir $(Q)$(TEST_ROOT)$(D)openjdk-jdk --output_file ${TEST_ROOT}$(D)TKG$(D)SHA.txt From 1b194139d7c6f915905d3984a5dfc16aba9a0618 Mon Sep 17 00:00:00 2001 From: Sophia Guo Date: Wed, 11 Dec 2024 12:28:50 -0500 Subject: [PATCH 2/3] Records all SHAs --- scripts/build_test.xml | 11 ------ scripts/getSHA.sh | 71 --------------------------------------- scripts/getSHAs.sh | 76 ++++++++++++++++++++++++++++++++++++++++++ scripts/resultsSum.pl | 6 ++-- settings.mk | 15 +++++---- 5 files changed, 88 insertions(+), 91 deletions(-) delete mode 100755 scripts/getSHA.sh create mode 100755 scripts/getSHAs.sh diff --git a/scripts/build_test.xml b/scripts/build_test.xml index 1248c8e5..e5f6f931 100644 --- a/scripts/build_test.xml +++ b/scripts/build_test.xml @@ -51,17 +51,6 @@ build.list is ${build.list} - - - - - - - - - - - diff --git a/scripts/getSHA.sh b/scripts/getSHA.sh deleted file mode 100755 index 6a39dd3f..00000000 --- a/scripts/getSHA.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash -# -# Licensed 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 -# -# https://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. - -REPO_DIR="" -OUTPUT_FILE="../SHA.txt" - - -usage () -{ - echo 'This script use git command to get sha in the provided REPO_DIR HEAD and write the info into the OUTPUT_FILE' - echo 'Usage : ' - echo ' --repo_dir: local git repo dir' - echo ' --output_file: the file to write the sha info to. Default is to ../SHA.txt' - -} - -parseCommandLineArgs() -{ - while [[ $# -gt 0 ]] && [[ ."$1" = .-* ]] ; do - opt="$1"; - shift; - case "$opt" in - "--repo_dir" | "-d" ) - REPO_DIR="$1"; shift;; - - "--output_file" | "-o" ) - OUTPUT_FILE="$1"; shift;; - - "--help" | "-h" ) - usage; exit 0;; - - *) echo >&2 "Invalid option: ${opt}"; echo "This option was unrecognized."; usage; exit 1; - esac - done - if [ -z "$REPO_DIR" ] || [ -z "$OUTPUT_FILE" ] || [ ! -d "$REPO_DIR" ]; then - echo "Error, please see the usage and also check if $REPO_DIR is existing" - usage - exit 1 - fi -} - -timestamp() { - date +"%Y%m%d-%H%M%S" -} - -getSHA() -{ - echo "Check sha in $REPO_DIR and store the info in $OUTPUT_FILE" - if [ ! -e ${OUTPUT_FILE} ]; then - echo "touch $OUTPUT_FILE" - touch $OUTPUT_FILE - fi - - cd $REPO_DIR - # append the info into $OUTPUT_FILE - { echo "================================================"; echo "timestamp: $(timestamp)"; echo "repo dir: $REPO_DIR"; echo "git repo: "; git remote show origin -n | grep "Fetch URL:"; echo "sha:"; git rev-parse HEAD; } 2>&1 | tee -a $OUTPUT_FILE -} -parseCommandLineArgs "$@" -getSHA - diff --git a/scripts/getSHAs.sh b/scripts/getSHAs.sh new file mode 100755 index 00000000..92abb622 --- /dev/null +++ b/scripts/getSHAs.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +# +# Licensed 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 +# +# https://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. + +TEST_ROOT="" +SHAs_FILE="" +workDIR=$(pwd) + +usage () +{ + echo 'This script use git command to get all shas in the provided TEST_ROOT and write the info into the SHAs file' + echo 'Usage : ' + echo ' --test_root_dir: optional' + echo ' --shas_file: optianal, the file to write the sha info to. Default is to ../SHAs.txt' + +} + +parseCommandLineArgs() +{ + while [[ $# -gt 0 ]] && [[ ."$1" = .-* ]] ; do + opt="$1"; + shift; + case "$opt" in + "--test_root_dir" | "-d" ) + TEST_ROOT="$1"; shift;; + + "--shas_file" | "-f" ) + SHAs_FILE="$1"; shift;; + + "--help" | "-h" ) + usage; exit 0;; + + *) echo >&2 "Invalid option: ${opt}"; echo "This option was unrecognized."; usage; exit 1; + esac + done + if [ -z "$TEST_ROOT" ] || [ -z "$SHAs_FILE" ] || [ ! -d "$TEST_ROOT" ]; then + echo "Error, please see the usage and also check if $TEST_ROOT is existing" + usage + exit 1 + fi +} + +timestamp() { + date +"%Y%m%d-%H%M%S" +} + +getSHAs() +{ + echo "Check shas in $TEST_ROOT and store the info in $SHAs_FILE" + if [ ! -e "${SHAs_FILE}" ]; then + echo "touch $SHAs_FILE" + touch "$SHAs_FILE" + fi + + cd "$TEST_ROOT" || exit + find "$TEST_ROOT" -type d -name ".git" | while read -r gitDir; do + repoDir=$(dirname "$gitDir") + cd "$repoDir" || continue + # append the info into $SHAs_FILR + { echo "================================================"; echo "timestamp: $(timestamp)"; echo "repo dir: $repoDir"; echo "git repo: "; git remote show origin -n | grep "Fetch URL:"; echo "sha:"; git rev-parse HEAD; } 2>&1 | tee -a "$SHAs_FILE" + done +} +parseCommandLineArgs "$@" +getSHAs +cd "$workDIR" || exit + diff --git a/scripts/resultsSum.pl b/scripts/resultsSum.pl index 04804d87..9e4e6c54 100755 --- a/scripts/resultsSum.pl +++ b/scripts/resultsSum.pl @@ -361,11 +361,11 @@ sub resultReporter { my $host = hostname; print $fhOut "# Hostname: " . $host . "\n\n"; - #add SHA.txt content in TAP file - my $SHAFile = $tapPath."../SHA.txt"; + #add SHAs.txt content in TAP file + my $SHAFile = $tapPath."../SHAs.txt"; my $SHAContent = `cat $SHAFile`; $SHAContent =~ s/\n/\n# /g; - print $fhOut "#SHA.txt content: \n# " . $SHAContent . "\n"; + print $fhOut "#SHAs.txt content: \n# " . $SHAContent . "\n"; print $fhOut "# Timestamp: " . $timeStamp . " UTC \n"; diff --git a/settings.mk b/settings.mk index b2341c28..f6d53408 100644 --- a/settings.mk +++ b/settings.mk @@ -12,7 +12,7 @@ # limitations under the License. ############################################################################## -.PHONY: help rmResultFile resultsSummary +.PHONY: help rmResultFile shaInfor resultsSummary help: @echo "This makefile is used to build and execute JVM tests. You should specify the following" @@ -364,7 +364,7 @@ $(SUBDIRS_TESTTARGET): $(TESTTARGET): $(SUBDIRS_TESTTARGET) -_$(TESTTARGET): setup_$(TESTTARGET) rmResultFile $(TESTTARGET) resultsSummary teardown_$(TESTTARGET) +_$(TESTTARGET): setup_$(TESTTARGET) rmResultFile $(TESTTARGET) shaInfor resultsSummary teardown_$(TESTTARGET) @$(ECHO) $@ done .PHONY: _$(TESTTARGET) $(TESTTARGET) $(SUBDIRS) $(SUBDIRS_TESTTARGET) @@ -443,13 +443,16 @@ endif rmResultFile: @$(RM) $(Q)$(TEMPRESULTFILE)$(Q) +shaInfor: + @$(ECHO_NEWLINE) + @$(ECHO_NEWLINE) + @$(ECHO) $(Q)Collect all REPOs sha $(Q) + $(CD) $(Q)$(TEST_ROOT)$(D)TKG$(D)scripts$(Q); \ + bash $(Q)getSHAs.sh$(Q) --test_root_dir $(Q)$(TEST_ROOT)$(Q) --shas_file $(Q)$(TEST_ROOT)$(D)TKG$(D)SHAs.txt$(Q) + resultsSummary: @$(ECHO_NEWLINE) @$(ECHO_NEWLINE) @$(ECHO) $(Q)All tests finished, run result summary:$(Q) $(CD) $(Q)$(TEST_ROOT)$(D)TKG$(D)scripts$(Q); \ perl $(Q)resultsSum.pl$(Q) --failuremk=$(Q)$(FAILEDTARGETS)$(Q) --resultFile=$(Q)$(TEMPRESULTFILE)$(Q) --platFile=$(Q)$(PLATFROMFILE)$(Q) --diagnostic=$(DIAGNOSTICLEVEL) --jdkVersion=$(JDK_VERSION) --jdkImpl=$(JDK_IMPL) --jdkVendor=$(Q)$(JDK_VENDOR)$(Q) --spec=$(SPEC) --buildList=$(BUILD_LIST) --customTarget=$(Q)$(CUSTOM_TARGET)$(Q) --testTarget=$(TESTTARGET) --tapPath=$(TESTOUTPUT)$(D) --tapName=$(TAP_NAME) --comment=$(Q)$(RESULT_COMMENT)$(Q) - -shaInfor: - $(CD) $(Q)$(TEST_ROOT)$(D)TKG$(D)scripts$(Q); \ - bash $(Q)getSHA.sh$(Q) --repo_dir $(Q)$(TEST_ROOT)$(D)openjdk-jdk --output_file ${TEST_ROOT}$(D)TKG$(D)SHA.txt From 29909e3d039a700c76bc194dd1c6d95ea07b7e22 Mon Sep 17 00:00:00 2001 From: Sophia Guo Date: Tue, 17 Dec 2024 11:02:16 -0500 Subject: [PATCH 3/3] update shaInfor to shaInfo --- settings.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/settings.mk b/settings.mk index f6d53408..d88c238c 100644 --- a/settings.mk +++ b/settings.mk @@ -12,7 +12,7 @@ # limitations under the License. ############################################################################## -.PHONY: help rmResultFile shaInfor resultsSummary +.PHONY: help rmResultFile shaInfo resultsSummary help: @echo "This makefile is used to build and execute JVM tests. You should specify the following" @@ -364,7 +364,7 @@ $(SUBDIRS_TESTTARGET): $(TESTTARGET): $(SUBDIRS_TESTTARGET) -_$(TESTTARGET): setup_$(TESTTARGET) rmResultFile $(TESTTARGET) shaInfor resultsSummary teardown_$(TESTTARGET) +_$(TESTTARGET): setup_$(TESTTARGET) rmResultFile $(TESTTARGET) shaInfo resultsSummary teardown_$(TESTTARGET) @$(ECHO) $@ done .PHONY: _$(TESTTARGET) $(TESTTARGET) $(SUBDIRS) $(SUBDIRS_TESTTARGET) @@ -443,7 +443,7 @@ endif rmResultFile: @$(RM) $(Q)$(TEMPRESULTFILE)$(Q) -shaInfor: +shaInfo: @$(ECHO_NEWLINE) @$(ECHO_NEWLINE) @$(ECHO) $(Q)Collect all REPOs sha $(Q)