From 1daa5c42a00652c30cad8a48dd7c0b0ebf08ff0e Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 24 May 2021 16:00:30 -0400 Subject: [PATCH] feat: edf_one_iter framework --- .../applications/ekf/one_iteration/.gitignore | 1 + .../ekf/one_iteration/edf_nopreemption.env | 2 + .../ekf/one_iteration/edf_preemption.env | 3 + .../ekf/one_iteration/fifo_nopreemption.env | 2 + .../ekf/one_iteration/fifo_preemption.env | 2 + .../ekf/one_iteration/initial_state.dat | Bin 0 -> 5088 bytes .../applications/ekf/one_iteration/run.sh | 94 ++++++++++-------- 7 files changed, 61 insertions(+), 43 deletions(-) create mode 100644 runtime/experiments/applications/ekf/one_iteration/edf_nopreemption.env create mode 100644 runtime/experiments/applications/ekf/one_iteration/edf_preemption.env create mode 100644 runtime/experiments/applications/ekf/one_iteration/fifo_nopreemption.env create mode 100644 runtime/experiments/applications/ekf/one_iteration/fifo_preemption.env create mode 100644 runtime/experiments/applications/ekf/one_iteration/initial_state.dat diff --git a/runtime/experiments/applications/ekf/one_iteration/.gitignore b/runtime/experiments/applications/ekf/one_iteration/.gitignore index f66ff46..d068a67 100644 --- a/runtime/experiments/applications/ekf/one_iteration/.gitignore +++ b/runtime/experiments/applications/ekf/one_iteration/.gitignore @@ -1 +1,2 @@ result.dat +res/* diff --git a/runtime/experiments/applications/ekf/one_iteration/edf_nopreemption.env b/runtime/experiments/applications/ekf/one_iteration/edf_nopreemption.env new file mode 100644 index 0000000..eeba531 --- /dev/null +++ b/runtime/experiments/applications/ekf/one_iteration/edf_nopreemption.env @@ -0,0 +1,2 @@ +SLEDGE_SCHEDULER=EDF +SLEDGE_DISABLE_PREEMPTION=true diff --git a/runtime/experiments/applications/ekf/one_iteration/edf_preemption.env b/runtime/experiments/applications/ekf/one_iteration/edf_preemption.env new file mode 100644 index 0000000..302a324 --- /dev/null +++ b/runtime/experiments/applications/ekf/one_iteration/edf_preemption.env @@ -0,0 +1,3 @@ +SLEDGE_SCHEDULER=EDF +SLEDGE_DISABLE_PREEMPTION=false +SLEDGE_SIGALRM_HANDLER=TRIAGED diff --git a/runtime/experiments/applications/ekf/one_iteration/fifo_nopreemption.env b/runtime/experiments/applications/ekf/one_iteration/fifo_nopreemption.env new file mode 100644 index 0000000..a572a70 --- /dev/null +++ b/runtime/experiments/applications/ekf/one_iteration/fifo_nopreemption.env @@ -0,0 +1,2 @@ +SLEDGE_SCHEDULER=FIFO +SLEDGE_DISABLE_PREEMPTION=true diff --git a/runtime/experiments/applications/ekf/one_iteration/fifo_preemption.env b/runtime/experiments/applications/ekf/one_iteration/fifo_preemption.env new file mode 100644 index 0000000..eb1298f --- /dev/null +++ b/runtime/experiments/applications/ekf/one_iteration/fifo_preemption.env @@ -0,0 +1,2 @@ +SLEDGE_SCHEDULER=FIFO +SLEDGE_DISABLE_PREEMPTION=false diff --git a/runtime/experiments/applications/ekf/one_iteration/initial_state.dat b/runtime/experiments/applications/ekf/one_iteration/initial_state.dat new file mode 100644 index 0000000000000000000000000000000000000000..9a960e1e986d6142e00a0c8c803f8c9463a7e541 GIT binary patch literal 5088 zcmeHLdpK3;8sBcYOtyMxbdeCE65>db?^{e;rExn&Ck#p2mFg(t64Tjc%Iprc-KNro z21f|F-?i3GB)5rjDcL30i5bordUle|F6&!+o;{g|F@Mf_9^Uo7-}`%i@B3SOee6$$ zMx#jze$Me{D5)%)EZN^ z^!WzhIu^!o2)qa4+#)Rdt(1tv+YZW{e>H?7TxF}Lo&F_rI7#AE_Pk8VmmI?(iAzrI zjZL+sE;z-t=X`E(-7tdo%t|W*-pcyF}uAR}IkCs+2# zz!Ev$MP^+W2q5QkBKr&``G!ecn1mQ>-|G#qBkHci53)wE!aNKU&(ncp7Tg%06fx*V z;!4T+Mo8RQk`Ljs-k!qL)gYux?EII>wUtmes$JPpW&*^LdLAWp=_luFA^W^d@+pwG zCC1KCs_q8xsf()fFZ-pT7x^4`q@H(4T}sLMej)o@Me_BKxSd@M8mzC>;m!2-ml_m& zlmwS9{9tD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OgEWYWH@la#mx)35 zxcyYC^R_Ym%d7M0~1ev(1fbM5G!zuM^i; zOGNYEe(mm~MO`t*Fe)fCD`(lv_fpkOqARW-WXfD)0>J#;Y^hUZO{g6&b z4>Y$Z9z7@YJdo~4U!JN_(pyPno0Rp6UoowHEMuj_jcFQ5@z+-7C~{g~=6T4$4REsX8bh#c4OVk!%ZB zSo`BQo3B>Ig8oTWjZl>UywI0@V4g!To{}NC*D}Z-M{)7y%q=fJj|MTz2R@ld`wBlW zKdCG1wiA_);!07&SIP{&18pH**V;yWsX8bh#S@f|nUtR82;Pet#~mp)1dXOyYPic$ zU;~Z3qU{7$r!TA*BR*rfP0m;M=8i|*yTxrjgekrmPfi^1#pqY`g4DZDaF;uon}kMh z!nQ1XWfgqx80N6<98tRWFgNr1cJrky56mq%TmM4!2`tOVbWrxREB3;Um#SID#Om>k wh6`J_8D?i<_PxZHd|xAD}w!*ap$L_`GWl!o!_BzJ9J+6f0vWbLjV8( literal 0 HcmV?d00001 diff --git a/runtime/experiments/applications/ekf/one_iteration/run.sh b/runtime/experiments/applications/ekf/one_iteration/run.sh index e60df65..8f78c3e 100755 --- a/runtime/experiments/applications/ekf/one_iteration/run.sh +++ b/runtime/experiments/applications/ekf/one_iteration/run.sh @@ -1,54 +1,62 @@ #!/bin/bash -# Executes the runtime in GDB -# Substitutes the absolute path from the container with a path relatively derived from the location of this script -# This allows debugging outside of the Docker container -# Also disables pagination and stopping on SIGUSR1 -experiment_directory=$(pwd) -echo "$experiment_directory" -project_directory=$(cd ../../../.. && pwd) -binary_directory=$(cd "$project_directory"/bin && pwd) -did_pass=true +# Add bash_libraries directory to path +__run_sh__base_path="$(dirname "$(realpath --logical "${BASH_SOURCE[0]}")")" +__run_sh__bash_libraries_relative_path="../../../bash_libraries" +__run_sh__bash_libraries_absolute_path=$(cd "$__run_sh__base_path" && cd "$__run_sh__bash_libraries_relative_path" && pwd) +export PATH="$__run_sh__bash_libraries_absolute_path:$PATH" -# Copy data if not here -if [[ ! -f "./ekf_raw.dat" ]]; then - cp ../../../tests/TinyEKF/extras/c/ekf_raw.dat ./ekf_raw.dat -fi +source csv_to_dat.sh || exit 1 +source framework.sh || exit 1 +source get_result_count.sh || exit 1 +source panic.sh || exit 1 +source path_join.sh || exit 1 -if [ "$1" != "-d" ]; then - PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & - sleep 1 -else - echo "Running under gdb" +# Copy data if not here +if [[ ! -f "$__run_sh__base_path/initial_state.dat" ]]; then + pushd "$__run_sh__base_path" || exit 1 + pushd "../../../../tests/TinyEKF/extras/c/" || exit 1 + cp ekf_raw.dat "$__run_sh__base_path/initial_state.dat" || exit 1 + popd || exit 1 + popd || exit 1 fi -expected_result="$(tr -d '\0' < ./expected_result.dat)" - -success_count=0 -total_count=50 - -for ((i = 0; i < total_count; i++)); do - result="$(curl -H 'Expect:' -H "Content-Type: application/octet-stream" --data-binary "@ekf_raw.dat" localhost:10000 2> /dev/null | tr -d '\0')" - if [[ "$expected_result" == "$result" ]]; then - success_count=$((success_count + 1)) +run_functional_tests() { + local -r hostname="$1" + local -r results_directory="$2" + local -i success_count=0 + local -ir total_count=50 + + local expected_result + expected_result="$(tr -d '\0' < ./expected_result.dat)" + + for ((i = 0; i < total_count; i++)); do + result="$(curl -H 'Expect:' -H "Content-Type: application/octet-stream" --data-binary "@ekf_raw.dat" localhost:10000 2> /dev/null | tr -d '\0')" + if [[ "$expected_result" == "$result" ]]; then + ((success_count++)) + else + echo "Failed on $i:" + echo "$result" + break + fi + done + + echo "$success_count / $total_count" + + if ((success_count == total_count)); then + echo "[OK]" + return 0 else - echo "FAIL" - did_pass=false - break + echo "[Fail]" + return 1 fi -done +} -echo "$success_count / $total_count" +experiment_main() { + local -r hostname="$1" + local -r results_directory="$2" -if [ "$1" != "-d" ]; then - sleep 5 - echo -n "Running Cleanup: " - pkill sledgert > /dev/null 2> /dev/null - echo "[DONE]" -fi + run_functional_tests "$hostname" "$results_directory" || return 1 +} -if $did_pass; then - exit 0 -else - exit 1 -fi +main "$@"