calliope-edu / CalliopEO_AstroPi

MIT License
1 stars 2 forks source link

Stages in test #41

Closed Amerlander closed 3 years ago

Amerlander commented 3 years ago

I wonder if we should combine the test cases.

The actuall aproach is like this:

# 1. Stage: Execute the CalliopEO.py script with nominal hex file
cp ${zipfile1} .
${cmd_calliope_script}
# Save return code
ret_code_1=$?

# 2. Stage: Execute the CalliopEO.py script with corrupted zip file
cp ${zipfile2} .
${cmd_calliope_script}
# Save return code
ret_code_2=$?

# 3. Stage: Execute the CalliopEO.py script again with nominal zip file
cp ${zipfile3} .
${cmd_calliope_script}
# Save return code
ret_code_3=$?

That way the python script runs three times. In a real world scenario we might have 10 .zip files each containing 5 .hex files uploaded at once. Maybe on of them is corrupted and 9 are fine. Then the python script runs one time and we want to be sure, that the script does not stop after it reaches the corrupted zip file.

So I feel like that might result in more stating tests:

cp ${zipfile1} ./01.zip
cp ${zipfile2} ./02.zip
cp ${zipfile1} ./03.zip
${cmd_calliope_script}
# Save return code
ret_code_1=$?

# Return code of script is 0?
echo -n "Check: Return code is 0 ... "
if [[ ${ret_code1} -eq 0 ]]; then
    echo "PASSED"
else
    echo "NOT PASSED"
fi

# Renamed .zip to .zip.done or zip.failed?
zipfile1_main=01.zip
zipfile1_done="${zipfile1_main}.done"
zipfile2_main=02.zip
zipfile2_failed="${zipfile2_main}.failed"
zipfile3_main=03.zip
zipfile3_done="${zipfile3_main}.done"
echo -n "Check: ZIP archive renamed to .done/.failed ... "
if [[ ! -e "${zipfile1_main}" && -e "${zipfile1_done}" && ! -e "${zipfile2_main}" && -e "${zipfile2_failed}" && ! -e "${zipfile3_main}" && -e "${zipfile3_done}" ]]; then
    echo "PASSED"
else
    echo "NOT PASSED"
fi

The same applys to test 05 corrupted hex and 07 transm timeout.