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 0000000..9a960e1 Binary files /dev/null and b/runtime/experiments/applications/ekf/one_iteration/initial_state.dat differ 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 "$@"