Skip to content

Commit

Permalink
runtests: add the total exection time in the end
Browse files Browse the repository at this point in the history
Signed-off-by: Pengfei Xu <[email protected]>
  • Loading branch information
xupengfe committed Jun 11, 2024
1 parent b30f57d commit 5fb63db
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions BM/runtests
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ NA="NA"
DEP_EXIT=$PASS_CODE

START_TIME=""
START_TIME_SEC=""
END_TIME_SEC=""
SUMMRY_LOG=""
readonly TESTS_SERVER="tests-server"
TEST_FILES=""
Expand Down Expand Up @@ -350,12 +352,17 @@ list_all_test_files() {
}

show_result() {
local execution_time=""

END_TIME_SEC=$(date +%s)
# Will record execution time 1s if it's less than 1s.
execution_time=$((END_TIME_SEC - START_TIME_SEC + 1))
# Add the following print for the end of the case summary.
echo "--------------------------------------------------------" >> "$SUMMRY_LOG"

echo "LKVS log $LOGFILE as above. Execution time:${execution_time}s." >> "$SUMMRY_LOG"
[[ -z "$LOGFILE" ]] || cat "$SUMMRY_LOG" >> "$LOGFILE"
cat "$SUMMRY_LOG"
echo "LKVS log $LOGFILE as above."

echo "The dependency info $DEP_LOG is as follows:"
cat "$DEP_LOG"
}
Expand All @@ -375,6 +382,7 @@ run_tests() {
cat /dev/null > "$LOGFILE"

START_TIME="$(date +%Y-%m-%d_%H-%M-%S)"
START_TIME_SEC=$(date +%s)
SUMMRY_LOG="/tmp/lkvs_${START_TIME}_summary.log"
echo "Test Start Time: $START_TIME" > "$SUMMRY_LOG"
{
Expand Down

0 comments on commit 5fb63db

Please sign in to comment.