Skip to content

Commit 3562e0c

Browse files
committed
Merge branch 'latest' into net
Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
2 parents 90c75af + d91d14c commit 3562e0c

File tree

1 file changed

+46
-43
lines changed

1 file changed

+46
-43
lines changed

entrypoint.sh

+46-43
Original file line numberDiff line numberDiff line change
@@ -814,20 +814,18 @@ build_packetdrill() { local old_pwd kversion branch rc=0
814814
return ${rc}
815815
}
816816

817-
prepare() { local mode no_tap=1
817+
build_tests() { local mode
818818
mode="${1}"
819819

820-
printinfo "Prepare the environment"
821-
822820
build_selftests
823821
if is_mode_btf "${mode}"; then
824822
build_bpftests
825823
fi
826824
build_packetdrill
825+
}
827826

828-
if is_ci; then
829-
no_tap=0 # we want subtests
830-
fi
827+
prepare() {
828+
printinfo "Prepare the environment"
831829

832830
cat <<EOF > "${BASH_PROFILE}"
833831
export KERNEL_BUILD_DIR="${VIRTME_BUILD_DIR}"
@@ -842,6 +840,40 @@ EOF
842840
echo "PS1='${ps1}'" >> "${BASH_PROFILE}"
843841
fi
844842

843+
if [ -f "${VIRTME_PREPARE_POST}" ]; then
844+
# shellcheck source=/dev/null
845+
source "${VIRTME_PREPARE_POST}"
846+
fi
847+
}
848+
849+
run() {
850+
printinfo "Run the virtme script: manual"
851+
852+
"${VIRTME_RUN}" "${VIRTME_RUN_OPTS[@]}" ${VIRTME_RUN_QEMU_OPTS:+--qemu-opts "${VIRTME_RUN_QEMU_OPTS[@]}"}
853+
}
854+
855+
run_expect() { local mode timestamps_sec_stop no_tap=1
856+
mode="${1}"
857+
858+
EXPECT=1
859+
860+
if is_ci; then
861+
no_tap=0 # we want subtests
862+
timestamps_sec_stop=$(date +%s)
863+
864+
# max - compilation time - before/after script
865+
VIRTME_EXPECT_TEST_TIMEOUT=$((INPUT_CI_TIMEOUT_SEC - (timestamps_sec_stop - TIMESTAMPS_SEC_START) - VIRTME_CI_ESTIMATED_EXTRA_TIME))
866+
else
867+
# disable timeout
868+
VIRTME_EXPECT_TEST_TIMEOUT="${INPUT_EXPECT_TIMEOUT}"
869+
fi
870+
871+
# force a stop in case of panic, but avoid a reboot in "expect" mode
872+
VIRTME_RUN_OPTS+=(--kopt panic=-1)
873+
VIRTME_RUN_QEMU_OPTS+=(-no-reboot)
874+
875+
printinfo "Run the virtme script: expect (timeout: ${VIRTME_EXPECT_TEST_TIMEOUT})"
876+
845877
cat <<EOF > "${VIRTME_SCRIPT}"
846878
#! /bin/bash
847879
@@ -1307,39 +1339,6 @@ echo "${VIRTME_SCRIPT_END}"
13071339
EOF
13081340
chmod +x "${VIRTME_SCRIPT}"
13091341

1310-
if [ -f "${VIRTME_PREPARE_POST}" ]; then
1311-
# shellcheck source=/dev/null
1312-
source "${VIRTME_PREPARE_POST}"
1313-
fi
1314-
}
1315-
1316-
run() {
1317-
printinfo "Run the virtme script: manual"
1318-
1319-
"${VIRTME_RUN}" "${VIRTME_RUN_OPTS[@]}" ${VIRTME_RUN_QEMU_OPTS:+--qemu-opts "${VIRTME_RUN_QEMU_OPTS[@]}"}
1320-
}
1321-
1322-
run_expect() {
1323-
local timestamps_sec_stop
1324-
1325-
EXPECT=1
1326-
1327-
if is_ci; then
1328-
timestamps_sec_stop=$(date +%s)
1329-
1330-
# max - compilation time - before/after script
1331-
VIRTME_EXPECT_TEST_TIMEOUT=$((INPUT_CI_TIMEOUT_SEC - (timestamps_sec_stop - TIMESTAMPS_SEC_START) - VIRTME_CI_ESTIMATED_EXTRA_TIME))
1332-
else
1333-
# disable timeout
1334-
VIRTME_EXPECT_TEST_TIMEOUT="${INPUT_EXPECT_TIMEOUT}"
1335-
fi
1336-
1337-
# force a stop in case of panic, but avoid a reboot in "expect" mode
1338-
VIRTME_RUN_OPTS+=(--kopt panic=-1)
1339-
VIRTME_RUN_QEMU_OPTS+=(-no-reboot)
1340-
1341-
printinfo "Run the virtme script: expect (timeout: ${VIRTME_EXPECT_TEST_TIMEOUT})"
1342-
13431342
cat <<EOF > "${VIRTME_SCRIPT_TIMEOUT}"
13441343
#! /bin/bash
13451344
DUMP_SEC=60
@@ -1398,7 +1397,7 @@ set timeout "1"
13981397
13991398
for {set i 0} {\$i < 60} {incr i 1} {
14001399
expect {
1401-
"root@" {
1400+
"root@${INPUT_HOSTNAME}" {
14021401
send_user "\n$(log_section_end)"
14031402
send_user "Starting the validation script (after \$i sec)\n"
14041403
break
@@ -1735,7 +1734,8 @@ prepare_all() { local t mode
17351734
setup_env "${mode}"
17361735
gen_kconfig "${@}"
17371736
build
1738-
prepare "${mode}"
1737+
build_tests "${mode}"
1738+
prepare
17391739
}
17401740

17411741
# $1: mode ; [ $2+: kconfig ]
@@ -1750,7 +1750,7 @@ go_expect() {
17501750
check_source_exec_all
17511751

17521752
prepare_all auto "${@}"
1753-
run_expect
1753+
run_expect "${@}"
17541754
analyze "${@}"
17551755
}
17561756

@@ -2000,12 +2000,15 @@ case "${INPUT_MODE}" in
20002000
"vm" | "vm-manual")
20012001
setup_env "${@:-normal}"
20022002
[ "${INPUT_PACKETDRILL_STABLE}" = "1" ] && build_packetdrill
2003+
prepare
20032004
run
20042005
;;
20052006
"vm-expect" | "vm-auto")
2007+
check_source_exec_all
20062008
setup_env "${@:-normal}"
20072009
[ "${INPUT_PACKETDRILL_STABLE}" = "1" ] && build_packetdrill
2008-
run_expect
2010+
prepare
2011+
run_expect "${@:-normal}"
20092012
analyze "${@:-normal}"
20102013
;;
20112014
"connect")

0 commit comments

Comments
 (0)