Skip to content

Commit efbb216

Browse files
committed
Add nightly performance tests into Gitlab NV pipeline
Add small fixes to shell script. Add heaptrack and heaptrack report converting to svg, then saving it as GitLab Pages for human checks. Relates-To: OLPEDGE-746 Signed-off-by: Yaroslav Stefinko <[email protected]>
1 parent 3ca174c commit efbb216

File tree

3 files changed

+73
-14
lines changed

3 files changed

+73
-14
lines changed

.gitlab-ci.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ variables:
66

77
stages:
88
- build
9+
- test
910
- translate_report
1011
- deploy
1112

@@ -52,13 +53,13 @@ build_test_nv:
5253
- $CI_PROJECT_DIR
5354
expire_in: 1 year
5455

55-
upload_sonar_nv:
56-
stage: deploy
56+
test_performance_nv:
57+
stage: test
5758
tags:
5859
- docker-prod
59-
image: ${DOCKER_REGISTRY}/${DOCKER_IMAGE_COVERAGE}:${DOCKER_IMAGE_COVERAGE_VERSION}
60+
image: ${DOCKER_REGISTRY}/${DOCKER_IMAGE_PERFORMANCE}:${DOCKER_IMAGE_PERFORMANCE_VERSION}
6061
script:
61-
- $CI_PROJECT_DIR/scripts/linux/nv/gitlab_cppcheck_and_upload_sonar.sh
62+
- $CI_PROJECT_DIR/scripts/linux/nv/gitlab_test_performance.sh
6263
only:
6364
refs:
6465
- master
@@ -68,9 +69,27 @@ upload_sonar_nv:
6869
artifacts:
6970
when: always
7071
paths:
72+
- ./*.gz
73+
- ./*.html
74+
- cache
75+
- heaptrack
7176
- reports
7277
expire_in: 1 year
7378

79+
upload_sonar_nv:
80+
stage: deploy
81+
tags:
82+
- docker-prod
83+
image: ${DOCKER_REGISTRY}/${DOCKER_IMAGE_COVERAGE}:${DOCKER_IMAGE_COVERAGE_VERSION}
84+
script:
85+
- $CI_PROJECT_DIR/scripts/linux/nv/gitlab_cppcheck_and_upload_sonar.sh
86+
only:
87+
refs:
88+
- master
89+
- schedules
90+
variables:
91+
- $NIGHTLY
92+
7493
translate_report:
7594
stage: translate_report
7695
tags:
@@ -83,6 +102,7 @@ translate_report:
83102
# - python -m junit2htmlreport --merge olp-merged-report.xml reports/*.xml
84103
# - python -m junit2htmlreport olp-merged-report.xml
85104
- python -m junit2htmlreport --report-matrix reports/index.html reports/*.xml
105+
- cat heaptrack_report.html >> reports/index.html
86106
- mkdir -p .public
87107
- cp reports/*.html .public/
88108
artifacts:
@@ -94,6 +114,7 @@ translate_report:
94114
- schedules
95115
variables:
96116
- $FULLY
117+
- $NIGHTLY
97118

98119
pages:
99120
stage: deploy
@@ -110,4 +131,5 @@ pages:
110131
- master
111132
- schedules
112133
variables:
113-
- $FULLY
134+
- $FULLY
135+
- $NIGHTLY

scripts/linux/fv/gitlab-olp-cpp-sdk-functional-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ done
6262
# Kill local server
6363
kill -15 ${SERVER_PID}
6464
# Waiter for server process to be exited correctly
65-
wait ${SERVER_PID}
65+
wait ${SERVER_PID}

scripts/linux/nv/gitlab_test_performance.sh

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
# SPDX-License-Identifier: Apache-2.0
1818
# License-Filename: LICENSE
1919

20-
ulimit -c unlimited # for core dump backtrace
20+
# For core dump backtrace
21+
ulimit -c unlimited
2122

2223
# Start local server
2324
node tests/utils/olp_server/server.js & export SERVER_PID=$!
@@ -38,11 +39,46 @@ echo ">>> Local Server started for further performance test ... >>>"
3839

3940
export cache_location="cache"
4041

41-
heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter="*short_test_null_cache"
42-
heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter="*short_test_memory_cache"
43-
heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter="*short_test_disk_cache"
42+
echo ">>> Start performance tests ... >>>"
43+
heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter="*short_test_null_cache" 2>> errors.txt || TEST_FAILURE=1
44+
mv heaptrack.olp-cpp-sdk-performance-tests.*.gz short_test_null_cache.gz
45+
heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter="*short_test_memory_cache" 2>> errors.txt || TEST_FAILURE=1
46+
mv heaptrack.olp-cpp-sdk-performance-tests.*.gz short_test_memory_cache.gz
47+
heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter="*short_test_disk_cache" 2>> errors.txt || TEST_FAILURE=1
48+
mv heaptrack.olp-cpp-sdk-performance-tests.*.gz short_test_disk_cache.gz
49+
echo ">>> Finished performance tests . >>>"
4450

45-
du -h $cache_location
51+
if [[ ${TEST_FAILURE} == 1 ]]; then
52+
echo "Printing error.txt ###########################################"
53+
cat errors.txt
54+
echo "End of error.txt #############################################"
55+
echo "CRASH ERROR. One of test groups contains crash. Report was not generated for that group ! "
56+
else
57+
echo "OK. Full list of tests passed. "
58+
fi
59+
60+
mkdir reports/heaptrack
61+
mkdir heaptrack
62+
63+
# Third party dependency needed for pretty graph generation below
64+
git clone --depth=1 https://github.com/brendangregg/FlameGraph
65+
66+
for archive_name in short_test_null_cache short_test_memory_cache short_test_disk_cache
67+
do
68+
heaptrack_print --print-leaks \
69+
--print-flamegraph heaptrack/flamegraph_${archive_name}.data \
70+
--file ${archive_name}.gz > reports/heaptrack/report_${archive_name}.txt
71+
# Pretty graph generation
72+
./FlameGraph/flamegraph.pl --title="Flame Graph: ${archive_name}" heaptrack/flamegraph_${archive_name}.data > reports/heaptrack/flamegraph_${archive_name}.svg
73+
cat reports/heaptrack/flamegraph_${archive_name}.svg >> heaptrack_report.html
74+
done
75+
cp heaptrack_report.html reports
76+
ls -la heaptrack
77+
ls -la
78+
79+
du ${cache_location}
80+
du ${cache_location}/*
81+
ls -la ${cache_location}
4682

4783
# TODO:
4884
# 1. print the total allocations done
@@ -51,6 +87,7 @@ du -h $cache_location
5187
# 4. track the disk IO made by SDK
5288
# 5. track the CPU load
5389

54-
#Kill local server
55-
kill -15 $SERVER_PID
56-
wait $SERVER_PID # Waiter for server process to be exited correctly
90+
# Gracefully stop local server
91+
kill -15 ${SERVER_PID}
92+
# Waiter for server process to be exited correctly
93+
wait ${SERVER_PID}

0 commit comments

Comments
 (0)