DOS tests
This page is for manual internal command line interface (the shell, the builtin commands, packaged "external" programs, etc.) tests. Unit tests are generally preferred, but sometimes manual tests are required either due to the inherent nature of the tests, or the implementation not being in a testable state.
CONFIG command
Set CONFIG environment variable
- Run
CONFIG -GET VER SET CONFIGshould display the currently set DOS version- Reset the variable with
SET CONFIG= - Run
CONFIG -GET DOS VER SET CONFIGshould display the currently set DOS version
DIR command
DIRCMD
- Run
SET DIRCMD=to clear the environment variable - Run
DIRand note how it displays timestamps - Run
DIR /Band note how it does not display timestamps - Run
SET DIRCMD=/B - Run
DIRagain and note how there are no timestamps, as withDIR /B
ECHO command
Batch file inheritance
- Create two files with the following contents in the same directory:
:: file1.bat
echo off
file2.bat
:: file2.bat
REM THIS SHOULDN'T BE PRINTED VIA FILE1.BAT
- Run
ECHO ON - Upon running
FILE1.BAT, the contents ofFILE2.BATshould not be printed
FOR command
Wildcard Matching
Ensure that any instances of wildcards (* and ?) in the for command's string set properly expand to the expected files in the current directory.
Examples:
FOR %C IN (*.TXT) DO ECHO %C -> Echoes all .TXT files in the current directory.
FOR %C IN (A??.*) DO ECHO %C -> Echoes all files in the current directory which start with 'A', and which have a name of at MOST 3 characters and an extension.
PATH command
The output of PATH and SET PATH should display the same contents, except that the PATH command doesn't display the preceeding PATH= before the directories
RENAME command
Wildcard matching
Wildcards are handled in both source and target of the rename. For the source, it collects a list of all files that match the wildcard in a fairly obvious manner (should be identical to the FOR command above).
Wildcards are expanded separately for the name and the extension.
It's a little tricky to explain how it expands the target wildcards so best to show examples.
Examples (these have been tested in both Dosbox Staging and real MS-DOS 6.22 via 86Box):
ren gamemaps.a test*.b -> file gets renamed to testmaps.b
ren *.a *.b -> changes extensions of all .a files to .b
ren a.exe test* -> file gets renamed to test (the a gets dropped since test is longer. the extension also gets dropped because there was no . in the target).
ren gamemaps.a test*foo.c -> file gets renamed to testmaps.c (anything after a * (foo in this case) gets ignored, extension gets changed as that is expanded separately from the name).
ren gamemaps.a ?test?.* -> file gets renamed to gtesta.a(? expands to a single character from the source in the same position. .* keeps the file extension the same).
SET command
Add a variable
- Enter
SET EXAMPLE=VALUE - Entering
SET EXAMPLEshould displayEXAMPLE=VALUE - Entering
SETshould display all environment variables, includingEXAMPLE
Remove a variable
- Enter
SET EXAMPLE= - Entering
SET EXAMPLEshould display a message sayingEXAMPLEis not defined - Entering
SETshould display all environment variables andEXAMPLEshould no longer be listed
SETVER command
Errors
The following should display an error message
SETVER XSETVER /B BAD ARGS
Piping commands
TMP and TEMP
Testing to make sure that these environment variables work involves looking at access timestamps for the relevant directories. This is because temporary files are deleted after they are used, so there are no traces of the file left to verify.
- Create a new temporary directory with
MKDIR TEMPDIR - Run
SET TEMP=TEMPDIR - Wait one minute to allow the directory timestamp to go out of date
- Run
A | PAUSE - Run
DIRand make sure the timestamp ofTEMPDIRis set to when the previous command was run - Run
SET TMP=TEMPDIR, thenSET TEMP=, then repeat the prevous three steps
Shell expansion
expand_shell_variable = false in config
- Run
ECHO ECHO %PATH% > PRNTPTH.BAT PRNTPTH.BATshould print the contents of thePATHenvironment variable
expand_shell_variable = true in config
ECHO %PATH%should print the contents of thePATHenvironment variable
Shell redirection
echo foo > test.txtshould writefoototest.txt, overwriting existing content if it does exist and creating a new file containingfooif it does not.echo foo >> test.txtshould append a new line containingfoototest.txtif it does exist or creating a new file containingfooif it does not.
Shell history
Encoding
- Run
KEYB US - Run
ECHO é(é -> ALT+130) - Reset DOSBox
- Run
KEYB US - The most recent command should be
ECHO é
Permissions
No read
- Navigate to
$DOSBOX_CONFIG/shell_history.txt - Remove the file's read permissions
-
- (Linux)
chmod u-r
- (Linux)
- Start DOSBox
- Apart from having no history, DOSBox should be working as expected
No write
- Navigate to
$DOSBOX_CONFIG/shell_history.txt - Remove the file's write permissions
-
- (Linux)
chmod u-w
- (Linux)
- Start DOSBox
- Shell history should still be visible (press up key to check)
Size limit
- Navigate to
$DOSBOX_CONFIG/shell_history.txt - Fill it with over 500 non-empty lines
-
- (Bash)
for i in `seq 1 501`; do echo $i >> $DOSBOX_CONFIG/shell_history.txt; done
- (Bash)
- Open DOSBox, then close it.
- Shell history file should only contain the 500 most recent lines
Unsaved commands
Exit
- Run
COMMAND - Run
EXIT - Pressing the up arrow should give
COMMAND
Consectutive Repetition
- Run
ECHO 1 - Run
ECHO 2three times - Pressing the up arrow should give
ECHO 2 - Pressing up again should give
ECHO 1
New history file
- Check that DOSBox is not open
- Delete
$DOSBOX_CONFIG/shell_history.txt - Open DOSBox
- Close DOSBox
- Check that a new
$DOSBOX_CONFIG/shell_history.txthas been made
General
How-to's
- Adding utilities
- Applications
- Config file examples
- Dual-mouse gaming
- Getting started
- Instant launch
- Joysticks and Gamepads
- Keymapper
- Multiplayer & serial ports
- Windows
Lists
- AUTOTYPE candidates
- CDDA / GUS / MIDI games
- DOS/32A compatibility
- Dual OPL2 and OPL3 games
- Games with enhanced Tandy & PCjr graphics and sound
- Shaders
- Special keys
Audio
- Audio mixer signal flow diagram
- Audio configuration recommendations
- GUS enhancements
- MIDI
- Sound cards
- True 16-bit audio games
Video
Issues
Dev
- How to contribute
- Release process
- Audio tests
- CPU tests
- DOS tests
- Input tests
- Performance tests
- Video tests — Video modes
- Video tests — CRT shaders
- Video tests — Presentation
- Learning DOS programming
- Intel compiler tips