| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | SOURCE="${BASH_SOURCE[0]}" |
| 4 | while [scip-shell system . . `[`. -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink |
| 5 | DIR="$( cd -P "$( dirnamescip-shell system . . dirname. "$SOURCE" )" >/dev/nullscip-shell filesystem . . `/dev/null`. && pwdscip-shell system . . pwd. )" |
| 6 | SOURCE="$(readlinkscip-shell system . . readlink. "$SOURCE")" |
| 7 | [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located |
| 8 | done |
| 9 | DIR="$( cd -P "$( dirnamescip-shell system . . dirname. "$SOURCE" )" >/dev/nullscip-shell filesystem . . `/dev/null`. && pwdscip-shell system . . pwd. )" |
| 10 | |
| 11 | # Variables |
| 12 | HELP=false |
| 13 | VERBOSE=false |
| 14 | DEBUG=false |
| 15 | CLEAN=false |
| 16 | WORKSPACE=$(pwdscip-shell system . . pwd.) |
| 17 | SECTIONS='all' |
| 18 | LIBFABRIC="" |
| 19 | |
| 20 | BUILD=true |
| 21 | TEST=true |
| 22 | UNITTEST=true |
| 23 | SMOKETEST=true |
| 24 | IMBTEST=true |
| 25 | OMBTEST=true |
| 26 | FABTEST=true |
| 27 | SFT=true |
| 28 | |
| 29 | function usagescip-shell shell shell-project 0.0.0 usage(). { |
| 30 | echoscip-shell system . . echo. \ |
| 31 | " |
| 32 | Usage: $(basenamescip-shell system . . basename. $SOURCE) [-dhv] |
| 33 | " |
| 34 | |
| 35 | } |
| 36 | |
| 37 | function set_sections_to_runscip-shell shell shell-project 0.0.0 set_sections_to_run(). { |
| 38 | BUILD=false |
| 39 | TEST=false |
| 40 | UNITTEST=false |
| 41 | SMOKETEST=false |
| 42 | IMBTEST=false |
| 43 | OMBTEST=false |
| 44 | FABTEST=false |
| 45 | SFT=false |
| 46 | |
| 47 | sections=$(echoscip-shell system . . echo. $@ | trscip-shell system . . tr. ',' ' ') |
| 48 | for section in $sections ; do |
| 49 | section_name=$(echoscip-shell system . . echo. $section | awkscip-shell system . . awk. '{print toupper($0)}') |
| 50 | case $section_name in |
| 51 | 'UNITTEST'|'SMOKETEST'|'IMBTEST'|'OMBTEST'|'FABTEST'|'SFT') |
| 52 | TEST=true |
| 53 | eval ${section_name}=true |
| 54 | ;; |
| 55 | 'ALL') |
| 56 | BUILD=true |
| 57 | TEST=true |
| 58 | UNITTEST=true |
| 59 | SMOKETEST=true |
| 60 | IMBTEST=true |
| 61 | OMBTEST=true |
| 62 | FABTEST=true |
| 63 | SFT=true |
| 64 | ;; |
| 65 | 'TEST') |
| 66 | TEST=true |
| 67 | UNITTEST=true |
| 68 | SMOKETEST=true |
| 69 | IMBTEST=true |
| 70 | OMBTEST=true |
| 71 | FABTEST=true |
| 72 | SFT=true |
| 73 | ;; |
| 74 | 'BUILD') |
| 75 | BUILD=true |
| 76 | ;; |
| 77 | *) |
| 78 | ;; |
| 79 | esac |
| 80 | done |
| 81 | |
| 82 | for each in BUILD TEST UNITTEST SMOKETEST IMBTEST OMBTEST SFT ; do |
| 83 | if $DEBUG ; then echoscip-shell system . . echo. ${each} = $(eval echo \$$each) ; fi |
| 84 | done |
| 85 | } |
| 86 | |
| 87 | OPTS=`getoptscip-shell system . . getopt. -o hdvcs:w:l: --long help,debug,verbose,clean,sections,workspace,libfabric -n 'parse-options' -- "$@"` |
| 88 | |
| 89 | if [scip-shell system . . `[`. $? != 0 ] ; then echoscip-shell system . . echo. "Failed parsing options." >&2 ; usagescip-shell shell shell-project 0.0.0 usage(). ; exit 1 ; fi |
| 90 | |
| 91 | eval set -- "$OPTS" |
| 92 | set -e |
| 93 | |
| 94 | while truescip-shell system . . true.; do |
| 95 | case "$1" in |
| 96 | -h | --help ) HELP=true ; shift ;; |
| 97 | -v | --verbose ) VERBOSE=true ; shift ;; |
| 98 | -d | --debug ) DEBUG=true ; shift ;; |
| 99 | -c | --clean ) CLEAN=true ; shift ;; |
| 100 | -s | --sections ) SECTIONS="$2" ; shift ; shift ;; |
| 101 | -w | --workspace ) WORKSPACE="$2" ; shift ; shift ;; |
| 102 | -l | --libfabric ) LIBFABRIC="$2" ; shift ; shift ;; |
| 103 | * ) break ;; |
| 104 | esac |
| 105 | done |
| 106 | |
| 107 | shift |
| 108 | |
| 109 | if $HELP ; then |
| 110 | usagescip-shell shell shell-project 0.0.0 usage(). |
| 111 | exit |
| 112 | fi |
| 113 | |
| 114 | function verbosescip-shell shell shell-project 0.0.0 verbose(). { |
| 115 | if $VERBOSE ; then |
| 116 | echoscip-shell system . . echo. $@ |
| 117 | fi |
| 118 | } |
| 119 | |
| 120 | function debugscip-shell shell shell-project 0.0.0 debug(). { |
| 121 | if $DEBUG ; then |
| 122 | echoscip-shell system . . echo. $0 |
| 123 | fi |
| 124 | } |
| 125 | |
| 126 | set_sections_to_runscip-shell shell shell-project 0.0.0 set_sections_to_run(). "$SECTIONS" |
| 127 | verbosescip-shell shell shell-project 0.0.0 verbose(). "HELP: $HELP" |
| 128 | verbosescip-shell shell shell-project 0.0.0 verbose(). "VERBOSE: $VERBOSE" |
| 129 | verbosescip-shell shell shell-project 0.0.0 verbose(). "DEBUG: $DEBUG" |
| 130 | verbosescip-shell shell shell-project 0.0.0 verbose(). "CLEAN: $CLEAN" |
| 131 | verbosescip-shell shell shell-project 0.0.0 verbose(). "SECTIONS: $SECTIONS" |
| 132 | verbosescip-shell shell shell-project 0.0.0 verbose(). "WORKSPACE: $WORKSPACE" |
| 133 | |
| 134 | for each in BUILD TEST UNITTEST SMOKETEST IMBTEST OMBTEST FABTEST SFT ; do |
| 135 | verbosescip-shell shell shell-project 0.0.0 verbose(). "$each: $(eval echo \$$each)" |
| 136 | done |
| 137 | |
| 138 | function section_startscip-shell shell shell-project 0.0.0 section_start(). { |
| 139 | echoscip-shell system . . echo. \ |
| 140 | " |
| 141 | ############################################################################## |
| 142 | Start of \"$1\" |
| 143 | ############################################################################## |
| 144 | " |
| 145 | } |
| 146 | |
| 147 | function section_endscip-shell shell shell-project 0.0.0 section_end(). { |
| 148 | echoscip-shell system . . echo. \ |
| 149 | " |
| 150 | ############################################################################## |
| 151 | End of \"$1\" |
| 152 | ############################################################################## |
| 153 | " |
| 154 | } |
| 155 | if $CLEAN ; then |
| 156 | if [[ -d $WORKSPACE ]] ; then |
| 157 | rmscip-shell system . . rm. -rf $WORKSPACE |
| 158 | fi |
| 159 | fi |
| 160 | |
| 161 | if [[ ! -d $WORKSPACE ]] ; then |
| 162 | mkdirscip-shell system . . mkdir. -p $WORKSPACE |
| 163 | fi |
| 164 | |
| 165 | SOURCE_DIR=$DIR/../../.. |
| 166 | pushd $SOURCE_DIR |
| 167 | |
| 168 | # Start Pipeline variables |
| 169 | export GIT_SHORT_COMMIT="$GIT_COMMIT" |
| 170 | export LIBFABRIC_INSTALL_PATH="" |
| 171 | export ROOT_BUILD_PATH="/scratch/jenkins/buildsscip-shell filesystem . . `/scratch/jenkins/builds`." |
| 172 | export FABTEST_PATH="${WORKSPACE}/fabtests" |
| 173 | export LIBFABRIC_BUILD_PATH="${ROOT_BUILD_PATH}/libfabric" |
| 174 | export OMB_BUILD_PATH="${ROOT_BUILD_PATH}/osu-micro-benchmarks/5.4.2/libexec/osu-micro-benchmarks/mpi" |
| 175 | export MPICH_PATH="${ROOT_BUILD_PATH}/mpich/stable" |
| 176 | export SFT_INSTALL_PATH="${ROOT_BUILD_PATH}/libfabric-sft/stable" |
| 177 | export BATS_INSTALL_PATH="${ROOT_BUILD_PATH}/bats/stable/bin" |
| 178 | export BATS_LOG_DIRECTORY="$WORKSPACE/logs" |
| 179 | export IMB_BUILD_PATH="${ROOT_BUILD_PATH}/imb/v2019.6" |
| 180 | # End pipeline variables |
| 181 | |
| 182 | # Start Prologue |
| 183 | GIT_SHORT_COMMIT=$(gitscip-shell system . . git. log -n 1 --pretty=format:'%h') |
| 184 | |
| 185 | contrib/cray/bin/verify_requirements.sh |
| 186 | contrib/cray/bin/setup.sh |
| 187 | # End Prologue |
| 188 | |
| 189 | if [[ -z $LIBFABRIC ]] ; then |
| 190 | LIBFABRIC_INSTALL_PATH="${WORKSPACE}/builds/libfabric/${GIT_SHORT_COMMIT}" |
| 191 | else |
| 192 | LIBFABRIC_INSTALL_PATH="$LIBFABRIC" |
| 193 | fi |
| 194 | echoscip-shell system . . echo. using installed libfabric @ ${LIBFABRIC_INSTALL_PATH} |
| 195 | |
| 196 | if $BUILD ; then |
| 197 | section_startscip-shell shell shell-project 0.0.0 section_start(). 'build' |
| 198 | # Start Build |
| 199 | ./autogen.sh |
| 200 | ./configure --prefix=$LIBFABRIC_INSTALL_PATH |
| 201 | makescip-shell system . . make. -j12 |
| 202 | makescip-shell system . . make. install |
| 203 | # End Build |
| 204 | section_endscip-shell shell shell-project 0.0.0 section_end(). 'build' |
| 205 | fi |
| 206 | |
| 207 | LF_LIBRARY=${LIBFABRIC_INSTALL_PATH}/lib/libfabric.so |
| 208 | if [[ ! -f ${LF_LIBRARY} ]] ; then |
| 209 | echoscip-shell system . . echo. could not find libfabric library |
| 210 | echoscip-shell system . . echo. expected file: ${LF_LIBRARY} |
| 211 | exit |
| 212 | fi |
| 213 | |
| 214 | if $TEST ; then |
| 215 | section_startscip-shell shell shell-project 0.0.0 section_start(). 'test' |
| 216 | # Start Test Phase |
| 217 | export LD_LIBRARY_PATH=$LIBFABRIC_INSTALL_PATH/lib:$LD_LIBRARY_PATH |
| 218 | export MPIR_CVAR_OFI_USE_PROVIDER='verbs;ofi_rxm' |
| 219 | |
| 220 | if $UNITTEST ; then |
| 221 | section_startscip-shell shell shell-project 0.0.0 section_start(). 'unit tests' |
| 222 | ## Start Unit Tests |
| 223 | sleepscip-shell system . . sleep. 1 |
| 224 | ## End Unit Tests |
| 225 | section_endscip-shell shell shell-project 0.0.0 section_end(). 'unit tests' |
| 226 | fi |
| 227 | |
| 228 | if $SMOKETEST ; then |
| 229 | section_startscip-shell shell shell-project 0.0.0 section_start(). 'smoke tests' |
| 230 | ## Start Smoke Tests |
| 231 | $BATS_INSTALL_PATH/bats $@ -t contrib/cray/bats/smoketests.bats | teescip-shell system . . tee. smoketests.tap |
| 232 | ## End Smoke Tests |
| 233 | section_endscip-shell shell shell-project 0.0.0 section_end(). 'smoke tests' |
| 234 | fi |
| 235 | |
| 236 | if $IMBTEST ; then |
| 237 | section_startscip-shell shell shell-project 0.0.0 section_start(). 'imb tests' |
| 238 | ## Start IMB Tests |
| 239 | $BATS_INSTALL_PATH/bats $@ -t contrib/cray/bats/imb.bats | teescip-shell system . . tee. imb.tap |
| 240 | ## End IMB Tests |
| 241 | section_endscip-shell shell shell-project 0.0.0 section_end(). 'imb tests' |
| 242 | fi |
| 243 | |
| 244 | if $OMBTEST ; then |
| 245 | section_startscip-shell shell shell-project 0.0.0 section_start(). 'omb tests' |
| 246 | ## Start OMB Tests |
| 247 | $BATS_INSTALL_PATH/bats $@ -t contrib/cray/bats/omb.bats | teescip-shell system . . tee. omb.tap |
| 248 | ## End OMB Tests |
| 249 | section_endscip-shell shell shell-project 0.0.0 section_end(). 'omb tests' |
| 250 | fi |
| 251 | |
| 252 | if $FABTEST ; then |
| 253 | section_startscip-shell shell shell-project 0.0.0 section_start(). 'fabtests' |
| 254 | ## Start Fabtests |
| 255 | if [[ ! -f $FABTEST_PATH/compile-target || "$(cat $FABTEST_PATH/compile-target)" != "$LIBFABRIC_INSTALL_PATH" ]] ; then |
| 256 | pushd $SOURCE_DIR/fabtests |
| 257 | ./autogen.sh |
| 258 | ./configure --with-libfabric=$LIBFABRIC_INSTALL_PATH --prefix=$FABTEST_PATH |
| 259 | makescip-shell system . . make. -j12 |
| 260 | makescip-shell system . . make. -j12 install |
| 261 | echoscip-shell system . . echo. $LIBFABRIC_INSTALL_PATH > $FABTEST_PATH/compile-target |
| 262 | popd |
| 263 | fi |
| 264 | |
| 265 | if [[ ! -f $FABTEST_PATH/bin/runfabtests.sh ]] ; then |
| 266 | echoscip-shell system . . echo. run the build step to install a version of fabtests for the current build |
| 267 | else |
| 268 | srun -n 2 --ntasks-per-node=1 contrib/cray/bin/fabtest_wrapper.sh -p ${FABTEST_PATH}/bin -v -T 60 | teescip-shell system . . tee. fabtests.log |
| 269 | fi |
| 270 | ## End Fabtests |
| 271 | section_endscip-shell shell shell-project 0.0.0 section_end(). 'fabtests' |
| 272 | fi |
| 273 | |
| 274 | if $SFT ; then |
| 275 | section_startscip-shell shell shell-project 0.0.0 section_start(). 'sft' |
| 276 | ## Start SFT |
| 277 | export SFT_BIN="${SFT_INSTALL_PATH}/bin" |
| 278 | export SFT_ADD_ARGS="--additional-args ' '" |
| 279 | export SFT_MAX_JOB_TIME='3' |
| 280 | export SFT_NUM_JOBS='4' |
| 281 | export SFT_PROVIDER='verbs;ofi_rxm' |
| 282 | export SFT_BASELINE_DIR="contrib/cray" |
| 283 | export SFT_BASELINE_RESULTS_FILE='sft_test_results_baseline.txt' |
| 284 | export SFT_PREVIOUS_BASELINE_RESULTS='sft_test_results_baseline.txt' |
| 285 | export SFT_TEST_CMDS='sft_test_commands' |
| 286 | export SFT_TEST_RESULTS='sft_test_results.xml' |
| 287 | export SFT_TEST_RESULTS_EXPECTED='expected_' |
| 288 | export SFT_TEST_RESULTS_PREFIX='BUILD_' |
| 289 | export SFT_TEST_RESULTS_CI='sft_ci_results.yaml' |
| 290 | export SFT_TEST_RESULTS_BASE_DIR="${ROOT_BUILD_PATH}/sft_test_results/" |
| 291 | export SFT_TEST_RESULTS_DIR="" |
| 292 | |
| 293 | export SFT_TEST_RESULTS_SUBDIR="${SFT_TEST_RESULTS_PREFIX}_${GIT_SHORT_COMMIT}_DATE_$(datescip-shell system . . date. +%Y_%m_%d_%H_%M_%S)" |
| 294 | export SFT_TEST_RESULTS_DIR="${SFT_TEST_RESULTS_BASE_DIR}${SFT_TEST_RESULTS_SUBDIR}" |
| 295 | |
| 296 | rmscip-shell system . . rm. -f ${SFT_BIN}/core* |
| 297 | rmscip-shell system . . rm. -rf ${SFT_TEST_RESULTS_DIR} |
| 298 | mkdirscip-shell system . . mkdir. -p ${SFT_TEST_RESULTS_DIR} |
| 299 | |
| 300 | pushd ${SFT_BIN} |
| 301 | timeoutscip-shell system . . timeout. 900 ./ci-all.sh \ |
| 302 | --provider 'verbs;ofi_rxm' \ |
| 303 | -L ${SFT_TEST_RESULTS_DIR} \ |
| 304 | --num-jobs ${SFT_NUM_JOBS} \ |
| 305 | --max-job-time ${SFT_MAX_JOB_TIME} \ |
| 306 | --output-cmds ${SFT_TEST_RESULTS_DIR}/${SFT_TEST_CMDS} \ |
| 307 | --results-file ${SFT_TEST_RESULTS_DIR}/${SFT_TEST_RESULTS_CI} |
| 308 | popd |
| 309 | |
| 310 | cpscip-shell system . . cp. ./${SFT_BASELINE_DIR}/${SFT_BASELINE_RESULTS_FILE} \ |
| 311 | ${SFT_TEST_RESULTS_DIR}/${SFT_TEST_RESULTS_EXPECTED}${SFT_BASELINE_RESULTS_FILE} |
| 312 | ${SFT_BIN}/sft_parse_test_results.pm \ |
| 313 | -b ${SFT_TEST_RESULTS_EXPECTED}${SFT_BASELINE_RESULTS_FILE} \ |
| 314 | -d ${SFT_TEST_RESULTS_DIR} \ |
| 315 | -o ${SFT_TEST_RESULTS} \ |
| 316 | -r ${SFT_BASELINE_RESULTS_FILE} |
| 317 | gzipscip-shell system . . gzip. -r ${SFT_TEST_RESULTS_DIR} |
| 318 | gunzipscip-shell system . . gunzip. ${SFT_TEST_RESULTS_DIR}/${SFT_TEST_RESULTS} |
| 319 | gunzipscip-shell system . . gunzip. ${SFT_TEST_RESULTS_DIR}/${SFT_BASELINE_RESULTS_FILE} |
| 320 | gunzipscip-shell system . . gunzip. ${SFT_TEST_RESULTS_DIR}/${SFT_TEST_RESULTS_EXPECTED}${SFT_BASELINE_RESULTS_FILE} |
| 321 | cpscip-shell system . . cp. -r ${SFT_TEST_RESULTS_DIR} . |
| 322 | |
| 323 | rmscip-shell system . . rm. -rf ${SFT_TEST_RESULTS_DIR} || truescip-shell system . . true. |
| 324 | ## End SFT |
| 325 | section_endscip-shell shell shell-project 0.0.0 section_end(). 'sft' |
| 326 | fi |
| 327 | |
| 328 | fi |