-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathperftest.sh
executable file
·1910 lines (1478 loc) · 65.1 KB
/
perftest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#echo "param:'$1'"
#
#------------------------------
#
# Import settings
#
. ~/.bash_profile
# Git branch
. ./settings.sh
# WriteLog() function
. ./timestampLogger.sh
# UninstallHPCC() fuction
declare -f -F UninstallHPCC > /dev/null
if [ $? -ne 0 ]
then
. ./UninstallHPCC.sh
fi
# CloneRepo()
declare -f -F CloneRepo > /dev/null
if [ $? -ne 0 ]
then
. ~/build/bin/cloneRepo.sh
fi
#
#------------------------------
#
# Check parameter
#
if [ "$1." != "." ]
then
param=$1
upperParam=${param^^}
echo "Param: ${upperParam}"
case $upperParam in
HTHOR) PERF_RUN_HTHOR=1
PERF_RUN_THOR=0
PERF_RUN_ROXIE=0
;;
THOR) PERF_RUN_HTHOR=0
PERF_RUN_THOR=1
PERF_RUN_ROXIE=0
;;
ROXIE) PERF_RUN_HTHOR=0
PERF_RUN_THOR=0
PERF_RUN_ROXIE=1
;;
BUILD) # Only build
PERF_BUILD=1
PERF_RUN_HTHOR=0
PERF_RUN_THOR=0
PERF_RUN_ROXIE=0
;;
*) # Dry run
PERF_RUN_HTHOR=0
PERF_RUN_THOR=0
PERF_RUN_ROXIE=0
PERF_BUILD=0
;;
esac
fi
#
#------------------------------
#
# Constants
#
# ------------------------------------------------
# Defined in settings.sh
#
#BUILD_TYPE=RelWithDebInfo
#LOG_DIR=~/HPCCSystems-regression/log
#BUILD_DIR=~/build
#BUILD_HOME=${BUILD_DIR}/CE/platform/build
#TEST_ROOT=${BUILD_DIR}/CE/platform
#TEST_ENGINE_HOME=${PLATFORM_HOME}/testing/regress
#PERF_TEST_HOME=${PERF_TEST_ROOT}/ecl-bundles/PerformanceTesting
# ------------------------------------------------
BIN_HOME=$OBT_LOG_DIR
PLATFORM_HOME=$SOURCE_HOME
LONG_DATE=$(date "+%Y-%m-%d_%H-%M-%S")
BUILD_LOG_FILE=${BIN_HOME}/"Perf_build_"${LONG_DATE}".log";
PERF_TEST_ROOT=~/perftest
PERF_TEST_HOME=${PERF_TEST_ROOT}/PerformanceTesting/PerformanceTesting
PERF_TEST_LOG=${BIN_HOME}/Perf_test-${LONG_DATE}.log
PERF_TEST_REPO=https://github.com/hpcc-systems/PerformanceTesting.git
TIMEOUTED_FILE_LISTPATH=${BIN_HOME}
TIMEOUTED_FILE_LIST_NAME=${TIMEOUTED_FILE_LISTPATH}/PerformanceTimeoutedTests.csv
TIMEOUT_TAG="//timeout 90"
PARALLEL_QUERIES=0
PERF_RESULT=PASS
#
#----------------------------------------------------
#
ProcessLog()
{
total=$(cat ${TEST_LOG_DIR}/$1*.log | sed -n "s/^[[:space:]]*Queries:[[:space:]]*\([0-9]*\)[[:space:]]*$/\1/p")
passed=$(cat ${TEST_LOG_DIR}/$1*.log | sed -n "s/^[[:space:]]*Passing:[[:space:]]*\([0-9]*\)[[:space:]]*$/\1/p")
failed=$(cat ${TEST_LOG_DIR}/$1*.log | sed -n "s/^[[:space:]]*Failure:[[:space:]]*\([0-9]*\)[[:space:]]*$/\1/p")
WriteLog "TestResult:Total:${total} passed:${passed} failed:${failed}" "${PERF_TEST_LOG}"
if [[ $failed -ne 0 ]]
then
PERF_RESULT=FAILED
fi
}
DeletePackage()
{
WriteLog "Remove package" "${PERF_TEST_LOG}"
${SUDO} ${PKG_QRY_CMD} | grep '[h]pcc' |
while read hpcc_package
do
WriteLog "HPCC package:"${hpcc_package} "${PERF_TEST_LOG}"
res=$( ${SUDO} ${PKG_REM_CMD} $hpcc_package 2>&1 )
WriteLog "Res: ${hpcc_package}" "${PERF_TEST_LOG}"
[ $? -ne 0 ] && WriteLog "HPCC package uninstall failed" "${PERF_TEST_LOG}"
done
${SUDO} ${PKG_QRY_CMD} | grep hpcc > /dev/null 2>&1
if [ $? -eq 0 ]
then
WriteLog "Can't remove HPCC package: ${hpcc_package}" "${PERF_TEST_LOG}"
fi
WriteLog "Delete package(s)" "${PERF_TEST_LOG}"
res=$( find ${BUILD_HOME} -maxdepth 1 -name 'hpccsystems-platform-community*' -type f -print -exec rm '{}' \; 2>&1 )
WriteLog "Res: ${res}" "${PERF_TEST_LOG}"
query="thor|roxie|d[af][fslu]|ecl[s|c|\s|a][g|c]|sase"
WriteLog "Check if any hpcc owned process is running (query: ${query})" "${PERF_TEST_LOG}"
res=$(pgrep -l "${query}" 2>&1)
if [ -n "$res" ]
then
WriteLog "res:${res}" "${PERF_TEST_LOG}"
${SUDO} pkill -9 "${query}"
# Give it some time
sleep 1m
res=$(pgrep -l "${query}" 2>&1)
WriteLog "After pkill res:${res}" "${PERF_TEST_LOG}"
else
WriteLog "Tere is no leftover process" "${PERF_TEST_LOG}"
fi
}
#
#----------------------------------------------------
#
# Start Performance Test process
#
WriteLog "Performance Test started" "${PERF_TEST_LOG}"
STARTUP_MSG=""
if [[ "$PERF_BUILD" -eq 1 ]]
then
STARTUP_MSG=${STARTUP_MSG}"build, "
fi
if [[ "$PERF_RUN_HTHOR" -eq 1 ]]
then
STARTUP_MSG=${STARTUP_MSG}"hthor, "
fi
if [[ "$PERF_RUN_THOR" -eq 1 ]]
then
STARTUP_MSG=${STARTUP_MSG}"thor, "
fi
if [[ "$PERF_RUN_ROXIE" -eq 1 ]]
then
STARTUP_MSG=${STARTUP_MSG}"roxie "
fi
if [[ -n "$STARTUP_MSG" ]]
then
WriteLog "Execute performance suite on ${STARTUP_MSG}" "${PERF_TEST_LOG}"
else
WriteLog "No target selected. This is a dry run." "${PERF_TEST_LOG}"
fi
CORE_LIMIT='unlimited' #$(( 256 * 1024 )) # 256 MB (256kb * 1024b [blocksize])
WriteLog "Set core file size to ${CORE_LIMIT} blocks. It is enough to stack trace and \ncore file(s) doesn't consume the entirely disk space if something went wrong." "${PERF_TEST_LOG}"
ulimit -c ${CORE_LIMIT}
WriteLog "$(ulimit -a)" "${PERF_TEST_LOG}"
#
#---------------------------
#
# Determine the package manager
WriteLog "packageExt: '${PKG_EXT}', installCMD: '${PKG_INST_CMD}'." "${PERF_TEST_LOG}"
#
#---------------------------
#
# Clean system
#
WriteLog "Clean system" "${PERF_TEST_LOG}"
[ ! -e $PERF_TEST_ROOT ] && mkdir -p $PERF_TEST_ROOT
rm -rf ${PERF_TEST_ROOT}/*
cd ${PERF_TEST_ROOT}
#
#---------------------------
#
# Uninstall HPCC to free as much disk space as can
#
if [[ ${PERF_KEEP_HPCC} -eq 0 ]]
then
WriteLog "Uninstall HPCC to free as much disk space as can" "${PERF_TEST_LOG}"
WriteLog "Uninstall HPCC-Platform" "${PERF_TEST_LOG}"
UninstallHPCC "${PERF_TEST_LOG}" "${PERF_WIPE_OFF_HPCC}"
else
WriteLog "Skip Uninstall HPCC on ${TARGET_PLATFORM} but stop it!" "${PERF_TEST_LOG}"
StopHpcc "${PERF_TEST_LOG}"
DeletePackage
fi
# Get RTE
WriteLog "Get the latest Regression Test Engine..." "${PERF_TEST_LOG}"
[[ -d $REGRESSION_TEST_ENGINE_HOME ]] && rm -rf $REGRESSION_TEST_ENGINE_HOME
cres=$( CloneRepo "https://github.com/AttilaVamos/RTE.git" "$REGRESSION_TEST_ENGINE_HOME" )
if [[ 0 -ne $? ]]
then
WriteLog "RTE clone failed ! Result is: ${cres}" "${PERF_TEST_LOG}"
cd ${OBT_BIN_DIR}
./archiveLogs.sh obt-build timestamp=${OBT_TIMESTAMP}
ExitEpilog "${PERF_TEST_LOG}" "build.sh" "RTE clone failed ! Result is: ${cres}"
else
WriteLog "RTE clone success !" "${PERF_TEST_LOG}"
fi
#
#--------------------------------------------------
#
# Build it
#
if [[ $PERF_BUILD -eq 1 ]]
then
WriteLog " " "${PERF_TEST_LOG}"
WriteLog "*******************************************" "${PERF_TEST_LOG}"
WriteLog " Build HPCC Platform from ${BUILD_HOME} ..." "${PERF_TEST_LOG}"
WriteLog " " "${PERF_TEST_LOG}"
#
#-------------------------------------------------------------------------------------
# Build HPCC
#
WriteLog "Build started ($0)" "${PERF_TEST_LOG}"
WriteLog "Clean up and prepare..." "${PERF_TEST_LOG}"
if [ ! -d ${BUILD_DIR}/$RELEASE_TYPE ]
then
mkdir -p ${BUILD_DIR}/$RELEASE_TYPE
fi
WriteLog "PWD: $(pwd)" "${PERF_TEST_LOG}"
cd ${BUILD_DIR}/$RELEASE_TYPE
buildTarget=build-${BRANCH_ID}-${LONG_DATE}
if [[ $NEW_BUILD_DIR_STRUCTURE -ne 0 ]]
then
if [[ -d build ]]
then
WriteLog "$BUILD_TYPE build remove build dir." "${PERF_TEST_LOG}"
res=$( rm -rf build )
[[ $? -ne 0 ]] && WriteLog " 'rm -rf build' return with ${res}" "${PERF_TEST_LOG}"
fi
if [[ -f build ]]
then
WriteLog "$BUILD_TYPE build remove link to build dir." "${PERF_TEST_LOG}"
res=$( rm build )
[[ $? -ne 0 ]] && WriteLog " 'rm build' return with ${res}" "${PERF_TEST_LOG}"
fi
mkdir build
[[ -d build ]] && WriteLog " 'build' directory created." "${PERF_TEST_LOG}"
else
# Use the old linked build directory structure
WriteLog "$BUILD_TYPE build remove build dir." "${PERF_TEST_LOG}"
res=$( rm build )
[[ $? -ne 0 ]] && WriteLog " 'rm build' return with ${res}" "${PERF_TEST_LOG}"
WriteLog "Create symlink for build to ${buildTarget}." "${PERF_TEST_LOG}"
mkdir ${buildTarget}
ln -s ${buildTarget} build
fi
# Remove all build-* directory older than a week (?)
#
WriteLog "Remove all build-* directory older than ${BUILD_DIR_EXPIRE} days." "${PERF_TEST_LOG}"
res=$( find . -maxdepth 1 -type d -mtime +${BUILD_DIR_EXPIRE} -iname 'build-*' -print -exec rm -rf '{}' \; 2>&1 )
WriteLog "res:${res}" "${PERF_TEST_LOG}"
WriteLog "Done." "${PERF_TEST_LOG}"
# ------------------------------------
# Git repo clone
#
WriteLog "Git repo clone" "${PERF_TEST_LOG}"
target=HPCC-Platform-${BRANCH_ID}-${LONG_DATE}
cRes=$( CloneRepo "https://github.com/hpcc-systems/HPCC-Platform.git" "${target}" )
if [[ 0 -ne $? ]]
then
#WriteLog "Repo clone failed ! Result is: ${cres}" "${PERF_TEST_LOG}"
#ExitEpilog "${PERF_TEST_LOG}"
WriteLog "Repo clone failed ! Result is: ${cres}" "${PERF_TEST_LOG}"
buildResult=FAILED
export buildResult
exit -2
else
WriteLog "Repo clone success !" "${PERF_TEST_LOG}"
WriteLog "Create symlink for HPCC-Platform to ${target}." "${PERF_TEST_LOG}"
[[ -h HPCC-Platform ]] && rm HPCC-Platform || ( [[ -d HPCC-Platform ]] && rm -rf HPCC-Platform)
ln -s ${target} HPCC-Platform
WriteLog "Done." "${PERF_TEST_LOG}"
# Remove all HPCC-Platform-* directory older than a week (?)
#
WriteLog "Remove all HPCC-Platform-* directory older than ${SOURCE_DIR_EXPIRE} days." "${PERF_TEST_LOG}"
res=$( find . -maxdepth 1 -type d -mtime +${SOURCE_DIR_EXPIRE} -iname 'HPCC-Platform-*' -print -exec rm -rf '{}' \; 2>&1 )
WriteLog "res:${res}" "${PERF_TEST_LOG}"
WriteLog "Done." "${PERF_TEST_LOG}"
fi
# -----------------------------------------
# We use branch which is set in settings.sh
#
WriteLog "We use branch: ${BRANCH_ID} which is set in settings.sh" "${PERF_TEST_LOG}"
cd ${PLATFORM_HOME}
echo "git branch: ${BRANCH_ID}" > ${GIT_2DAYS_LOG}
echo "git checkout ${BRANCH_ID}" >> ${GIT_2DAYS_LOG}
WriteLog "git checkout ${BRANCH_ID}" "${PERF_TEST_LOG}"
res=$( git checkout ${BRANCH_ID} 2>&1 )
echo $res >> ${GIT_2DAYS_LOG}
WriteLog "Result:${res}" "${PERF_TEST_LOG}"
if [[ -n "$SHA" ]]
then
res=$( git checkout ${SHA} 2>&1 )
WriteLog "Result:${res}" "${PERF_TEST_LOG}"
COMMIT_ID=$SHA
else
COMMIT_ID=$( git log -1 | grep '^commit' | cut -d' ' -f 2 )
COMMIT_ID=${COMMIT_ID:0:8}
fi
branchDate=$( git log -1 | grep '^Date' )
WriteLog "Branch ${branchDate}" "${PERF_TEST_LOG}"
echo $branchDate >> ${GIT_2DAYS_LOG}
branchCrc=$( git log -1 | grep '^commit' )
WriteLog "Branch ${branchCrc}" "${PERF_TEST_LOG}"
echo $branchCrc>> ${GIT_2DAYS_LOG}
export COMMIT_ID
echo "git remote -v:" >> ${GIT_2DAYS_LOG}
git remote -v >> ${GIT_2DAYS_LOG}
echo "" >> ${GIT_2DAYS_LOG}
cat ${BUILD_DIR}/bin/gitlog.sh >> ${GIT_2DAYS_LOG}
${BUILD_DIR}/bin/gitlog.sh >> ${GIT_2DAYS_LOG}
#
# Update submodule
#
WriteLog "Update git submodule" "${PERF_TEST_LOG}"
subRes=$( SubmoduleUpdate "--init --recursive" )
if [[ 0 -ne $? ]]
then
WriteLog "Submodule update failed ! Result is: ${subRes}" "${PERF_TEST_LOG}"
exit -3
else
WriteLog "Submodule update success !" "${PERF_TEST_LOG}"
fi
#
#----------------------------------------------------
#
# Check and cache boost package into $HOME directory and
# copy it into ${BUILD_HOME}/downloads/ directory to avoid on-fly download attempt in build
#
# Should get these information from HPCC-Platform/cmake_modules/buildBOOST_REGEX.cmake:
# URL https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.gz
#
#BOOST_URL="https://dl.bintray.com/boostorg/release/1.71.0/source/$BOOST_PKG"
BOOST_URL=$( egrep 'URL ' $SOURCE_HOME/cmake_modules/buildBOOST_REGEX.cmake| awk '{print $2}')
#BOOST_PKG="boost_1_71_0.tar.gz"
BOOST_PKG=${BOOST_URL##*/};
WriteLog "Check if $BOOST_PKG cached" "${PERF_TEST_LOG}"
if [[ ! -f $HOME/$BOOST_PKG ]]
then
WriteLog "It is not, download it." "${PERF_TEST_LOG}"
BOOST_DOWNLOAD_TRY_COUNT=5
BOOST_DOWNLOAD_TRY_DELAY=2m
while [[ $BOOST_DOWNLOAD_TRY_COUNT -gt 0 ]]
do
WriteLog "Try count: $BOOST_DOWNLOAD_TRY_COUNT" "${PERF_TEST_LOG}"
BOOST_DOWNLOAD_TRY_COUNT=$(( $BOOST_DOWNLOAD_TRY_COUNT - 1 ))
download_res=$( wget -v -O $HOME/$BOOST_PKG $BOOST_URL 2>&1 )
retCode=$?
if [[ $retCode -ne 0 ]]
then
WriteLog "Error: $retCode '${download_res}'. Wait ${BOOST_DOWNLOAD_TRY_DELAY} for retry." "${PERF_TEST_LOG}"
sleep ${BOOST_DOWNLOAD_TRY_DELAY}
[[ -f $HOME/$BOOST_PKG ]] && rm $HOME/$BOOST_PKG
else
WriteLog "The $BOOST_PKG downloaded." "${PERF_TEST_LOG}"
WriteLog "Ping: ${download_res}" "${PERF_TEST_LOG}"
DOWNL=$( echo "$download_res" | tail -nhead -n 2)
WriteLog "${DOWNL}" "${OBT_LOG_DIR}/$BOOST_PKG.download"
break
fi
done
fi
if [[ ! -f $HOME/$BOOST_PKG ]]
then
WriteLog "The $BOOST_PKG download attempts were unsuccessful." "${PERF_TEST_LOG}"
else
WriteLog "The $BOOST_PKG downloaded, copy it into the source tree." "${PERF_TEST_LOG}"
mkdir -p ${BUILD_HOME}/downloads
res=$( cp -v $HOME/$BOOST_PKG ${BUILD_HOME}/downloads/ 2>&1 )
WriteLog "res: ${res}" "${PERF_TEST_LOG}"
fi
removeLog4j=$( find $SOURCE_HOME/ -iname '*log4j*' -type f -exec rm -fv {} \; )
WriteLog "Remove LOG4J items result:\n${removeLog4j}" "${PERF_TEST_LOG}"
removeCommonsText=$( find $SOURCE_HOME/ -iname 'commons-text-*.jar' -type f -exec rm -fv {} \; )
WriteLog "Remove 'commons-text-*.jar' items result:\n${removeCommonsText}" "${PERF_TEST_LOG}"
#
# Prepare to build
#
cd ${BUILD_HOME}
BASE_VERSION=${BRANCH_ID#candidate-}
BASE_VERSION=${BASE_VERSION%.*}
[[ "$BASE_VERSION" != "master" ]] && BASE_VERSION=$BASE_VERSION.x
VCPKG_DOWNLOAD_ARCHIVE=~/vcpkg_downloads-${BASE_VERSION}.zip
WriteLog "BRANCH_ID: $BRANCH_ID, BASE_VERSION: $BASE_VERSION, VCPKG_DOWNLOAD_ARCHIVE: $VCPKG_DOWNLOAD_ARCHIVE" "$PERF_TEST_LOG"
if [[ -f $VCPKG_DOWNLOAD_ARCHIVE ]]
then
WriteLog "Extract $VCPKG_DOWNLOAD_ARCHIVE into build directory" "$PERF_TEST_LOG"
res=$( unzip $VCPKG_DOWNLOAD_ARCHIVE 2>&1 )
retCode=$?
[[ $retCode -ne 0 ]] && WriteLog "retCode: ${retCode}\nRes: $res" "$PERF_TEST_LOG"
WriteLog " Done." "$PERF_TEST_LOG"
else
WriteLog "The $VCPKG_DOWNLOAD_ARCHIVE not found." "$PERF_TEST_LOG"
fi
date=$( date "+%Y-%m-%d %H:%M:%S")
WriteLog "Start build at ${date}" "${PERF_TEST_LOG}"
# if [ ! -f ${BUILD_DIR}/bin/build_perf.sh ]
# then
# C_CMD="/usr/local/bin/cmake -D CMAKE_BUILD_TYPE=$PERF_BUILD_TYPE -DMAKE_DOCS=0 -DUSE_CPPUNIT=1 -DTEST_PLUGINS=0 -DINCLUDE_PLUGINS=0 -DSUPPRESS_PY3EMBED=ON -DINCLUDE_PY3EMBED=OFF -DUSE_LIBXSLT=ON -DXALAN_LIBRARIES= -D CMAKE_ECLIPSE_MAKE_ARGUMENTS=-30 -DECLWATCH_BUILD_STRATEGY='IF_MISSING' ../HPCC-Platform ln -s ../HPCC-Platform"
# # C_CMD="cmake -D INCLUDE_PY3EMBED=OFF -D PY3EMBED=OFF -D SUPPRESS_PY3EMBED=ON -DUSE_LIBXSLT=ON -DXALAN_LIBRARIES= -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D CMAKE_ECLIPSE_MAKE_ARGUMENTS=-30 -DECLWATCH_BUILD_STRATEGY='IF_MISSING' ../HPCC-Platform ln -s ../HPCC-Platform"
# WriteLog "${C_CMD}" "${PERF_TEST_LOG}"
#
# res=( "$(${C_CMD} 2>&1)" )
# WriteLog "${res[*]}" "${PERF_TEST_LOG}"
# else
#WriteLog "Execute '${BUILD_DIR}/bin/build_perf.sh'" "${PERF_TEST_LOG}"
#C_CMD="/usr/local/bin/cmake -DCMAKE_BUILD_TYPE=$PERF_BUILD_TYPE -DTEST_PLUGINS=0 -DINCLUDE_PLUGINS=0 -DSUPPRESS_PY3EMBED=ON -DINCLUDE_PY3EMBED=OFF -DMAKE_DOCS=0 -DUSE_CPPUNIT=1 -DINCLUDE_SPARK=0 -DSUPPRESS_SPARK=1 -DSPARK=0 -DGENERATE_COVERAGE_INFO=0 -DUSE_LIBXSLT=ON -DXALAN_LIBRARIES= -DMYSQL_LIBRARIES=/usr/lib64/mysql/libmysqlclient.so -DMYSQL_INCLUDE_DIR=/usr/include/mysql -DMAKE_MYSQLEMBED=1 -DECLWATCH_BUILD_STRATEGY=SKIP ../HPCC-Platform ln -s ../HPCC-Platform"
# C_CMD="cmake -D INCLUDE_PY3EMBED=OFF -D PY3EMBED=OFF -D SUPPRESS_PY3EMBED=ON -DUSE_LIBXSLT=ON -DXALAN_LIBRARIES= -D CMAKE_BUILD_TYPE=$BUILD_TYPE -D CMAKE_ECLIPSE_MAKE_ARGUMENTS=-30 -DECLWATCH_BUILD_STRATEGY='IF_MISSING' ../HPCC-Platform ln -s ../HPCC-Platform"
WriteLog "Create makefiles $(date +%Y-%m-%d_%H-%M-%S)" "${PERF_TEST_LOG}"
GENERATOR="Eclipse CDT4 - Unix Makefiles"
CMAKE_CMD=$'cmake'
#CMAKE_CMD+=$' -G "'${GENERATOR}$'"'
CMAKE_CMD+=$' -D CMAKE_BUILD_TYPE='$PERF_BUILD_TYPE
CMAKE_CMD+=$' -D INCLUDE_PLUGINS=0'
#CMAKE_CMD+=$' -D SUPPRESS_PY3EMBED=ON -D INCLUDE_PY3EMBED=OFF'
CMAKE_CMD+=${SUPRESS_PLUGINS}
CMAKE_CMD+=$' -D MAKE_DOCS=0'
CMAKE_CMD+=$' -D USE_CPPUNIT=0'
#CMAKE_CMD+=$' -D ECLWATCH_BUILD_STRATEGY=SKIP'
#CMAKE_CMD+=$' -D INCLUDE_SPARK=0 -D SUPPRESS_SPARK=1 -D SPARK=0'
CMAKE_CMD+=$' -D CMAKE_EXPORT_COMPILE_COMMANDS=ON'
CMAKE_CMD+=$' -D USE_LIBXSLT=ON -D XALAN_LIBRARIES='
CMAKE_CMD+=$' -D MAKE_CASSANDRAEMBED=1'
#CMAKE_CMD+=$' -D CMAKE_ECLIPSE_MAKE_ARGUMENTS=-30 ../HPCC-Platform ln -s '
CMAKE_CMD+=$' ../HPCC-Platform'
WriteLog "CMAKE_CMD:'${CMAKE_CMD}'\\n" "${PERF_TEST_LOG}"
#eval ${CMAKE_CMD} >> "${PERF_TEST_LOG}" 2>&1
res=$( eval ${CMAKE_CMD} 2>&1 )
#res=( "$(${C_CMD} 2>&1)" )
WriteLog "${res[*]}" "${PERF_TEST_LOG}"
# fi
# Control TBB and TBBMALLOC stuff
if [[ $PERF_CONTROL_TBB -eq 1 ]]
then
C_CMD="/usr/local/bin/cmake -D USE_TBB=$PERF_USE_TBB -DUSE_TBBMALLOC=$PERF_USE_TBBMALLOC ../HPCC-Platform"
WriteLog "${C_CMD}" "${PERF_TEST_LOG}"
res=( "$(${C_CMD} 2>&1)" )
echo "${res[*]}" > ${BUILD_LOG_FILE}
fi
# Let's build
CMD="make -j ${NUMBER_OF_BUILD_THREADS} package"
#CMD="make -j 1 package"
WriteLog "cmd: ${CMD}" "${PERF_TEST_LOG}"
${CMD} >> ${BUILD_LOG_FILE} 2>&1
#WriteLog "Execute it again: ${CMD}" "${PERF_TEST_LOG}"
#res=$( ${CMD} 2>&1 )
#WriteLog "build result:${res}" "${PERF_TEST_LOG}"
if [ $? -ne 0 ]
then
WriteLog "Build failed: build has errors " "${PERF_TEST_LOG}"
buildResult=FAILED
export buildResult
exit 1
else
ls -l hpcc*${PKG_EXT} >/dev/null 2>&1
if [ $? -ne 0 ]
then
WriteLog "Build failed: no rpm package found " "${PERF_TEST_LOG}"
buildResult=FAILED
exit 2
else
WriteLog "Build succeed" "${PERF_TEST_LOG}"
buildResult=SUCCEED
if [[ $NEW_BUILD_DIR_STRUCTURE -ne 0 ]]
then
pushd ${BUILD_DIR}/$RELEASE_TYPE
WriteLog "Move 'build' to '$buildTarget' (PWD:$(pwd))." "${PERF_TEST_LOG}"
mv build $buildTarget
WriteLog "Create link as 'build'" "${PERF_TEST_LOG}"
ln -s ${buildTarget} build
WriteLog " Done. (retCode: $?)'. " "${PERF_TEST_LOG}"
popd
fi
if [[ -d ${BUILD_HOME}/vcpkg_installed ]]
then
BASE_VERSION=${BRANCH_ID#candidate-}
BASE_VERSION=${BASE_VERSION%.*}
[[ "$BASE_VERSION" != "master" ]] && BASE_VERSION=$BASE_VERSION.x
WriteLog "Check the content of vcpkg_downloads-${BASE_VERSION}.zip file" "${PERF_TEST_LOG}"
# We need relative paths to use this archive in Smoketest as well
pushd ${BUILD_HOME}
rm -rf vcpkg_downloads/tools vcpkg_downloads/temp
changesInInstalled=1
changesInDownloads=1
if [[ -f ~/vcpkg_downloads-${BASE_VERSION}.zip ]]
then
cp -fv ~/vcpkg_downloads-${BASE_VERSION}.zip .
changesInInstalled=$( zip -ru vcpkg_downloads-${BASE_VERSION}.zip vcpkg_installed/* )
WriteLog "Changes in installed: '$changesInInstalled'." "${PERF_TEST_LOG}"
changesInDownloads=$( zip -u vcpkg_downloads-${BASE_VERSION}.zip vcpkg_downloads/* )
WriteLog "Changes in downloads: '$changesInDownloads'." "${PERF_TEST_LOG}"
fi
if [[ -n "$changesInInstalled" || -n "$changesInDownloads" ]]
then
# Don't use the local vcpkg_downloads-${BASE_VERSION}.zip file updated above,
# because it can contain older version of components along with the new one and
# its size can grows more than necessary.
WriteLog "Something changed, generate a new '~/vcpkg_downloads-${BASE_VERSION}.zip'." "${PERF_TEST_LOG}"
[[ -f ~/vcpkg_downloads-${BASE_VERSION}.zip ]] && WriteLog "Clean-up: $(rm -v ~/vcpkg_downloads-${BASE_VERSION}.zip) 2>&1)." "${PERF_TEST_LOG}"
res=$(zip -r ~/vcpkg_downloads-${BASE_VERSION}.zip vcpkg_installed/* vcpkg_downloads/* 2>&1)
retCode=$?
[[ $retCode -ne 0 ]] && WriteLog "retCode: ${retCode}\nRes: $res" "${PERF_TEST_LOG}"
WriteLog " Done." "${PERF_TEST_LOG}"
else
WriteLog "Nothing changed neither in vcpkg_installed nor in vcpkg_dowloads,\nso, keep the original '~/vcpkg_downloads-${BASE_VERSION}.zip'." "${PERF_TEST_LOG}"
fi
[[ -f ./vcpkg_downloads-${BASE_VERSION}.zip ]] && WriteLog "Clean-up: $(rm -v ./vcpkg_downloads-${BASE_VERSION}.zip) 2>&1)." "${PERF_TEST_LOG}"
WriteLog "Clean-up 'build/vcpkg_*', '_CPack_Packages' and 'esp' '$RELEASE_TYPE' directories to save disk space." "${PERF_TEST_LOG}"
WriteLog "Before: $(df -h . | egrep -v 'Files')" "${PERF_TEST_LOG}"
for d in vcpkg_downloads vcpkg_installed _CPack_Packages esp $RELEASE_TYPE
do
WriteLog "rm -rf $d" "${PERF_TEST_LOG}"
rm -rf $d
WriteLog "Res: $?" "${PERF_TEST_LOG}"
done
WriteLog "After: $(df -h . | egrep -v 'Files')" "${PERF_TEST_LOG}"
WriteLog " Done." "${PERF_TEST_LOG}"
fi
fi
fi
date=$( date "+%Y-%m-%d %H:%M:%S")
WriteLog "Build end at ${date}" "${PERF_TEST_LOG}"
HPCC_PACKAGE=$( find . -maxdepth 1 -name 'hpccsystems-platform-community*' -type f )
WriteLog " Default package: '${HPCC_PACKAGE}'." "${PERF_TEST_LOG}"
WriteLog " " "${PERF_TEST_LOG}"
else
WriteLog " " "${PERF_TEST_LOG}"
WriteLog "*******************************************" "${PERF_TEST_LOG}"
WriteLog " Skip build HPCC Platform... " "${PERF_TEST_LOG}"
WriteLog " " "${PERF_TEST_LOG}"
cd ${BUILD_HOME}
HPCC_PACKAGE=$( find . -maxdepth 1 -name 'hpccsystems-platform-community*' -type f )
WriteLog " Default package: '${HPCC_PACKAGE}' ." "${PERF_TEST_LOG}"
WriteLog " " "${PERF_TEST_LOG}"
fi
TARGET_PLATFORM="hthor"
if [[ "$PERF_RUN_HTHOR" -eq 1 ]]
then
#***************************************************************
#
# HTHOR test
#
#***************************************************************
WriteLog " " "${PERF_TEST_LOG}"
WriteLog "********************************" "${PERF_TEST_LOG}"
WriteLog " Start ${TARGET_PLATFORM} test. " "${PERF_TEST_LOG}"
WriteLog " " "${PERF_TEST_LOG}"
#
# --------------------------------------------------------------
# Install HPCC
#
# if [[ ${PERF_KEEP_HPCC} -eq 0 ]]
# then
# WriteLog "Remove environment.xml to ensure clean, out-of-box environmnet." "${PERF_TEST_LOG}"
# sudo rm /etc/HPCCSystems/environment.xml
#
# WriteLog "Install HPCC Platform ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
#
# ${SUDO} ${PKG_INST_CMD} ${BUILD_HOME}/${HPCC_PACKAGE}
#
# if [ $? -ne 0 ]
# then
# WriteLog "Error in install! ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
# exit
# fi
# else
# WriteLog "Start HPCC Platform ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
# ${SUDO} /etc/init.d/hpcc-init start
# fi
#
# --------------------------------------------------------------
# Install HPCC
#
if [ -f /etc/HPCCSystems/environment.xml ]
then
WriteLog "Remove environment.xml to ensure clean, out-of-box environmnet." "${PERF_TEST_LOG}"
sudo rm /etc/HPCCSystems/environment.xml
fi
WriteLog "Install HPCC Platform ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
${SUDO} ${PKG_INST_CMD} ${BUILD_HOME}/${HPCC_PACKAGE}
if [ $? -ne 0 ]
then
WriteLog "Error in install! ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
exit 1
fi
# Add Write permission to /var/lib/HPCCSystems and its subdiretories
${SUDO} chmod -R 0777 /var/lib/HPCCSystems
#
#---------------------------
#
# Patch environment.xml to use diferent size Memory
#
MEMSIZE=$(( $PERF_HTHOR_MEMSIZE_GB * (2 ** 30) ))
# for hthor we should change 'defaultMemoryLimitMB' as well
MEMSIZE_MB=$(( $PERF_HTHOR_MEMSIZE_GB * (2 ** 10) ))
WriteLog "Patch environment.xml to use ${PERF_HTHOR_MEMSIZE_GB}GB Memory for test on ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
${SUDO} cp /etc/HPCCSystems/environment.xml /etc/HPCCSystems/environment.xml.bak
${SUDO} sed -e 's/totalMemoryLimit="1073741824"/totalMemoryLimit="'${MEMSIZE}'"/g' -e 's/defaultMemoryLimitMB="300"/defaultMemoryLimitMB="'${MEMSIZE_MB}'"/g' "/etc/HPCCSystems/environment.xml" > temp.xml && ${SUDO} mv -f temp.xml "/etc/HPCCSystems/environment.xml"
WriteLog "Patch environment.xml to use ${PERF_THOR_NUMBER_OF_SLAVES} slaves for Thor" "${PERF_TEST_LOG}"
WriteLog "Patch environment.xml to use ${PERF_THOR_LOCAL_THOR_PORT_INC} for localThorPortInc for Thor" "${PERF_TEST_LOG}"
#${SUDO} cp /etc/HPCCSystems/environment.xml /etc/HPCCSystems/environment.xml.bak
${SUDO} sed -e 's/slavesPerNode="\(.*\)"/slavesPerNode="'${PERF_THOR_NUMBER_OF_SLAVES}'"/g' \
-e 's/localThorPortInc="\(.*\)"/localThorPortInc="'${PERF_THOR_LOCAL_THOR_PORT_INC}'"/g' \
"/etc/HPCCSystems/environment.xml" > temp.xml && ${SUDO} mv -f temp.xml "/etc/HPCCSystems/environment.xml"
#
#----------------------------------------------------
#
# Kill Cassandra if it used too much memory
#
WriteLog "Check memory on ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
freeMem=$( free | egrep "^(Mem)" | awk '{print $4 }' )
WriteLog "Free memory is: ${freeMem} kB on ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
if [[ "$freeMem" -lt 3777356 ]]
then
WriteLog "Free memory too low on ${TARGET_PLATFORM}!" "${PERF_TEST_LOG}"
cassandraPID=$( ps ax | grep '[c]assandra' | awk '{print $1}' )
if [ -n "$cassandraPID" ]
then
WriteLog "Kill Cassandra (pid: ${cassandraPID}) on ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
kill -9 ${cassandraPID}
sleep 5
freeMem=$( free | egrep "^(Mem)" | awk '{print $4 }' )
if [[ "$freeMem" -lt 3777356 ]]
then
WriteLog "The free memory (${freeMem} kB) is still too low! Cannot start HPCC Systems!! Give it up on ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
# send email to Agyi
echo "After the kill Cassandra the Performance test free memory (${freeMem} kB) is still too low on ${TARGET_PLATFORM}! Performance test stopped!" | mailx -s "OBT Memory problem" -u $USER ${ADMIN_EMAIL_ADDRESS}
#exit -1
fi
fi
fi
WriteLog "Free memory is: ${freeMem} kB on ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
#
#---------------------------
#
# Check HPCC Systems
#
WriteLog "Check HPCC Systems on ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
NUMBER_OF_HPCC_COMPONENTS=$( /opt/HPCCSystems/sbin/configgen -env /etc/HPCCSystems/environment.xml -list | egrep -i -v 'eclagent' | wc -l )
hpccRunning=$( ${SUDO} /etc/init.d/hpcc-init status | grep -c "running")
if [[ "$hpccRunning" -ne ${NUMBER_OF_HPCC_COMPONENTS} ]]
then
WriteLog "Start HPCC System on ${TARGET_PLATFORM}..." "${PERF_TEST_LOG}"
${SUDO} /etc/init.d/hpcc-init start
fi
# give it some time
sleep 5
hpccRunning=$( ${SUDO} /etc/init.d/hpcc-init status | grep -c "running")
if [[ "$hpccRunning" -ne ${NUMBER_OF_HPCC_COMPONENTS} ]]
then
WriteLog "Unable start HPCC system!! Only ${hpccRunning} component is up on ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
exit -2
fi
#
#----------------------------------------------------
#
# Check if HPCC can generate core with execute ECL code
#
if [[ ${PERF_RUN_CORE_TEST} -eq 1 ]]
then
cd ${BIN_HOME}
WriteLog "Check ECL core generation." "${PERF_TEST_LOG}"
res=$( ulimit -a | grep '[c]ore' )
WriteLog "ulimit: ${res}" "${PERF_TEST_LOG}"
./checkCoreGen.sh ecl >> "${PERF_TEST_LOG}" 2>&1
cd ${REGRESSION_TEST_ENGINE_HOME}
# Add Write permission to /var/lib/HPCCSystems and its subdiretories
${SUDO} chmod -R 0777 /var/lib/HPCCSystems
WriteLog "Check ECL core generation with Regression Test Engine." "${PERF_TEST_LOG}"
CMD="./ecl-test run --suiteDir ${BIN_HOME} --timeout 15 -fthorConnectTimeout=36000 -t all"
WriteLog "CMD: '${CMD}'" "${PERF_TEST_LOG}"
${CMD} >> ${PERF_TEST_LOG} 2>&1
retCode=$( echo $? )
WriteLog "retcode: ${retCode}" "${PERF_TEST_LOG}"
cores=( $( find /var/lib/HPCCSystems/ -name 'core_*' -type f ) )
if [ ${#cores[@]} -ne 0 ]
then
WriteLog "There is/are ${#cores[@]} core file(s) '${cores[*]}'" "${PERF_TEST_LOG}"
if [ ${#cores[@]} -eq 3 ]
then
WriteLog "Core generation is OK!" "${PERF_TEST_LOG}"
else
WriteLog "Core generation failed on some platform(s)!" "${PERF_TEST_LOG}"
fi
WriteLog "Clean up." "${PERF_TEST_LOG}"
${SUDO} rm -f ${cores[*]}
rm eclcc.log
else
WriteLog "Problem with Core generation!" "${PERF_TEST_LOG}"
fi
rm -rf ${LOG_DIR}/*
else
WriteLog "Check core generation skipped." "${PERF_TEST_LOG}"
fi
#
#---------------------------
#
# Get test from github
#
WriteLog "Get Performance Test Boundle from github on ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
cd ${PERF_TEST_ROOT}
WriteLog "Pwd: ${myPwd} $TARGET_PLATFORM" "${PERF_TEST_LOG}"
WriteLog "Get test from github ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
cRes=$( CloneRepo "${PERF_TEST_REPO}" )
if [[ 0 -ne $? ]]
then
WriteLog "Repo clone failed ! Result is: ${cres}" "${PERF_TEST_LOG}"
exit -3
else
WriteLog "Repo clone success !" "${PERF_TEST_LOG}"
fi
cd ${REGRESSION_TEST_ENGINE_HOME}
#
#----------------------------------------------------
#
# Patch testcase(s) which previously run timeout if any
#echo "Patch testcases which previously run timeout if any ${TARGET_PLATFORM}"
#WriteLog "Patch testcases which previously run timeout if any ${TARGET_PLATFORM}" "${PERF_TEST_LOG}"
#if [ -f ${TIMEOUTED_FILE_LIST_NAME} ]
#then
# echo "There is some timeouted testcases"
# WriteLog "There is some timeouted testcases" "${PERF_TEST_LOG}"
# myPwd=$( pwd )
# cd ${PERF_TEST_HOME}/ecl
#
# while read fileName
# do
# echo "File:${fileName}"
# WriteLog "File:${fileName}" "${PERF_TEST_LOG}"
#
# patched=$( grep '//timeout' ${fileName}.ecl )
#
# if [[ -z ${patched} ]]
# then
# echo "Patching..."
# WriteLog "Patching..." "${PERF_TEST_LOG}"
# $(echo ${TIMEOUT_TAG}; cat ${fileName}".ecl") >${fileName}.new
# mv ${fileName}{.new,.ecl}
# else
# echo "Already has //timeout tag !"
# WriteLog "Already has //timeout tag !" "${PERF_TEST_LOG}"
# fi
# done < "${TIMEOUTED_FILE_LIST_NAME}"
#
# cd ${myPwd}
#fi
#
#----------------------------------------------------
#
# Exclude doesn't implement sort algos from Hthor
#
cd ${PERF_TEST_HOME}
excludeAlgos=('insertionsort' 'tbbstableqsort')
for i in ${excludeAlgos[@]}
do
WriteLog "i: ${i}" "${PERF_TEST_LOG}"