Skip to content

Commit

Permalink
Add multi bench hook for the run-file json
Browse files Browse the repository at this point in the history
Add the multibench hook for 'multi' scenario and update both the
single and multi bench cases to use the jq replacements with a
reusable function to process a json file.
  • Loading branch information
rafaelfolco committed Oct 11, 2023
1 parent 59ee8fd commit b4929d8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
12 changes: 12 additions & 0 deletions .github/actions/common-code/common-code.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# -*- mode: sh; indent-tabs-mode: nil; sh-basic-offset: 4 -*-
# vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=bash

function process_json() {
local json=$1; shift

jq "$@" "${json}" > "${json}.tmp"
if [ $? == 0 ]; then
/bin/mv "${json}.tmp" "${json}"
return 0
else
return 1
fi
}

function start_github_group {
local header
header="$@"
Expand Down
32 changes: 25 additions & 7 deletions .github/actions/integration-tests/run-ci-stage1
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,22 @@ for userenv in ${CI_ACTIVE_USERENVS}; do
run_cmd "crucible run iperf,uperf --tags run:2${TAGS} --num-samples ${CI_SAMPLES} --test-order r --mv-params ${SCRIPT_DIR}/mv-params/iperf-2.json,${SCRIPT_DIR}/mv-params/uperf-2.json ${ENDPOINT_ARG}"
post_run_cmd
fi

# multibench all-in-one json test
RUN_FILE="${SCRIPT_DIR}/run-file/ci-${scenario}-run-file-${CI_ENDPOINT}-${userenv}.json"
if [ -f "${RUN_FILE}" ]; then
count=$(process_json ${RUN_FILE} '.endpoints | length')
idx=0
while [ $idx -lt $count ]; do
process_json ${RUN_FILE} --argjson idx $idx --arg param "host" --arg host "${CI_ENDPOINT_HOST}" '."endpoints"[$idx] += { ($param): $host }'
process_json ${RUN_FILE} --argjson idx $idx --arg param "user" --arg user "${CI_ENDPOINT_USER}" '."endpoints"[$idx] += { ($param): $user }'
process_json ${RUN_FILE} --argjson idx $idx --arg param "userenv" --arg userenv "${userenv}" '."endpoints"[$idx] += { ($param): $userenv }'
let idx++
done
run_cmd "crucible run --from-file ${RUN_FILE}"
post_run_cmd
fi

;;
cyclictest)
case "${CI_ENDPOINT}" in
Expand Down Expand Up @@ -436,14 +452,16 @@ for userenv in ${CI_ACTIVE_USERENVS}; do

# Only run all-in-one json test if the runfile exists for the endpoint
# e.g.: ci-oslat-run-file-k8s-alma8.json
RUN_FILE="${SCRIPT_DIR}/run-file/ci-oslat-run-file-${CI_ENDPOINT}-${userenv}.json"
RUN_FILE="${SCRIPT_DIR}/run-file/ci-${scenario}-run-file-${CI_ENDPOINT}-${userenv}.json"
if [ -f "${RUN_FILE}" ]; then
sed -i "s|CI_REPEAT_RUNS|${CI_REPEAT_RUNS}|g" ${RUN_FILE}
sed -i "s|USERENV|${userenv}|g" ${RUN_FILE}
sed -i "s|SCRIPT_DIR|${SCRIPT_DIR}|g" ${RUN_FILE}
sed -i "s|CONTROLLER_IP|${CONTROLLER_IP}|g" ${RUN_FILE}
sed -i "s|CI_ENDPOINT_HOST|${CI_ENDPOINT_HOST}|g" ${RUN_FILE}
sed -i "s|CI_ENDPOINT_USER|${CI_ENDPOINT_USER}|g" ${RUN_FILE}
count=$(process_json ${RUN_FILE} '.endpoints | length')
idx=0
while [ $idx -lt $count ]; do
process_json ${RUN_FILE} --argjson idx $idx --arg param "host" --arg host "${CI_ENDPOINT_HOST}" '."endpoints"[$idx] += { ($param): $host }'
process_json ${RUN_FILE} --argjson idx $idx --arg param "user" --arg user "${CI_ENDPOINT_USER}" '."endpoints"[$idx] += { ($param): $user }'
process_json ${RUN_FILE} --argjson idx $idx --arg param "userenv" --arg userenv "${userenv}" '."endpoints"[$idx] += { ($param): $userenv }'
let idx++
done
run_cmd "crucible run --from-file ${RUN_FILE}"
post_run_cmd
fi
Expand Down

0 comments on commit b4929d8

Please sign in to comment.