Annotation of hatari/tests/configfile.sh, revision 1.1.1.1

1.1       root        1: #!/bin/sh
                      2: #
                      3: # Check whether loading and saving of config files works as expected
                      4: 
                      5: if [ $# -ne 1 -o "$1" = "-h" -o "$1" = "--help" ]; then
                      6:        echo "Usage: $0 <hatari>"
                      7:        exit 1;
                      8: fi
                      9: 
                     10: hatari=$1
                     11: shift
                     12: if [ ! -x "$hatari" ]; then
                     13:        echo "First parameter must point to valid hatari executable."
                     14:        exit 1;
                     15: fi;
                     16: 
                     17: testdir=$(mktemp -d)
                     18: cfgfile="$testdir"/.config/hatari/hatari.cfg
                     19: 
                     20: remove_temp() {
                     21:   rm -rf "$testdir"
                     22: }
                     23: trap remove_temp EXIT
                     24: 
                     25: keymap="$testdir"/keymap.txt
                     26: echo "# Temp file" > "$keymap"
                     27: 
                     28: acsifile="$testdir"/acsi.img
                     29: dd if=/dev/zero of="$acsifile" bs=512 count=1000 2> /dev/null
                     30: scsifile="$testdir"/scsi.img
                     31: dd if=/dev/zero of="$scsifile" bs=512 count=1000 2> /dev/null
                     32: idefile="$testdir"/ide.img
                     33: dd if=/dev/zero of="$idefile" bs=512 count=1000 2> /dev/null
                     34: 
                     35: export SDL_VIDEODRIVER=dummy
                     36: export SDL_AUDIODRIVER=dummy
                     37: export HOME="$testdir"
                     38: unset TERM
                     39: 
                     40: $hatari --log-level fatal --sound off --tos none --confirm-quit false \
                     41:        --machine tt --cpulevel 4 --cpuclock 16 --vdi 1 --drive-led 0 \
                     42:        --monitor tv --frameskips 3 --mousewarp off --statusbar FALSE \
                     43:        --disasm uae --joy0 keys --keymap "$keymap" --crop 1 --fast-boot 1 \
                     44:        --protect-floppy auto --gemdos-case upper --acsi 3="$acsifile" \
                     45:        --scsi 5="$scsifile" --ide-master "$idefile" --patch-tos off \
                     46:        --rs232-out "$testdir"/serial-out.txt --rs232-in /dev/null \
                     47:        --printer /dev/zero --avi-fps 60 --memsize 0 --alert-level fatal \
                     48:        --saveconfig >"$testdir/out.txt" 2>&1
                     49: exitstat=$?
                     50: if [ $exitstat -ne 0 ]; then
                     51:        echo "Running hatari with parameters FAILED. Status = ${exitstat}."
                     52:        cat "$testdir/out.txt"
                     53:        exit 1
                     54: fi
                     55: 
                     56: echo "############################## Log file: ##############################"
                     57: cat $cfgfile
                     58: 
                     59: # Check whether the command line options have been included in the config file:
                     60: echo "#################### Looking for expected settings: ###################"
                     61: grep "nTextLogLevel = 0" $cfgfile || exit 1
                     62: grep "bEnableSound = FALSE" $cfgfile || exit 1
                     63: grep "bConfirmQuit = FALSE" $cfgfile || exit 1
                     64: grep "nModelType = 4" $cfgfile || exit 1
                     65: grep "nCpuLevel = 4" $cfgfile || exit 1
                     66: grep "nCpuFreq = 16" $cfgfile || exit 1
                     67: grep "bUseExtVdiResolutions = TRUE" $cfgfile || exit 1
                     68: grep "bShowDriveLed = FALSE" $cfgfile || exit 1
                     69: grep "nMonitorType = 3" $cfgfile || exit 1
                     70: grep "nFrameSkips = 3" $cfgfile || exit 1
                     71: grep "bMouseWarp = FALSE" $cfgfile || exit 1
                     72: grep "bShowStatusbar = FALSE" $cfgfile || exit 1
                     73: grep "bDisasmUAE = TRUE" $cfgfile || exit 1
                     74: grep "nJoystickMode = 2" $cfgfile || exit 1
                     75: grep "szMappingFileName = $keymap" $cfgfile || exit 1
                     76: grep "nMemorySize = 512" $cfgfile || exit 1
                     77: grep "nWriteProtection = 2" $cfgfile || exit 1
                     78: grep "nGemdosCase = 1" $cfgfile || exit 1
                     79: grep "sDeviceFile3 = $acsifile" $cfgfile || exit 1
                     80: grep "sDeviceFile5 = $scsifile" $cfgfile || exit 1
                     81: grep "sDeviceFile0 = $idefile" $cfgfile || exit 1
                     82: grep "bPatchTos = FALSE" $cfgfile || exit 1
                     83: grep "bEnableRS232 = TRUE" $cfgfile || exit 1
                     84: grep "szOutFileName = $testdir/serial-out.txt" $cfgfile || exit 1
                     85: grep "szInFileName = /dev/null" $cfgfile || exit 1
                     86: grep "bEnablePrinting = TRUE" $cfgfile || exit 1
                     87: grep "szPrintToFileName = /dev/zero" $cfgfile || exit 1
                     88: grep "bCrop = TRUE" $cfgfile || exit 1
                     89: grep "AviRecordFps = 60" $cfgfile || exit 1
                     90: grep "nAlertDlgLogLevel = 0" $cfgfile || exit 1
                     91: 
                     92: echo "######################################################################"
                     93: 
                     94: # Now check that we can load and save the same config file again:
                     95: 
                     96: touch "$testdir"/test.cfg
                     97: cat > "$testdir"/commands.txt << EOF
                     98: setopt -c $testdir/test.cfg
                     99: setopt --saveconfig
                    100: EOF
                    101: 
                    102: $hatari --tos none --parse "$testdir"/commands.txt >"$testdir/out.txt" 2>&1
                    103: exitstat=$?
                    104: if [ $exitstat -ne 0 ]; then
                    105:        echo "Running hatari -c ${testdir}/test.cfg FAILED. Status ${exitstat}."
                    106:        cat "$testdir"/out.txt
                    107:        exit 1
                    108: fi
                    109: 
                    110: if ! diff -q "$cfgfile" "$testdir"/test.cfg ; then
                    111:        echo "Test FAILED, config files differs:"
                    112:        diff -u "$cfgfile" "$testdir"/test.cfg
                    113:        exit 1
                    114: fi
                    115: 
                    116: echo "Test PASSED."
                    117: exit 0

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.