tests: Remove the debug output file

I changed print to compile in the dprint() function when the testing
flag is enabled.  This allows tests to have the same output regardless
of debugging status.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Bryan Schumaker 2013-08-07 20:54:45 -04:00 committed by Anna Schumaker
parent a190047648
commit f76021be99
12 changed files with 24 additions and 50 deletions

11
.gitignore vendored
View File

@ -1,13 +1,6 @@
*.o
*.swp
*.swo
*.pyc
*.sw*
#*.pyc
*.run
*.test
*.tar.gz
.*
ocarina.bin
.sconsign.dblite
bin/
PKGBUILD
!PKGBUILD.tmpl

View File

@ -7,10 +7,12 @@ install
Printing: (include/print.h>
Sometimes text needs to be printed to the screen so users (or debuggers)
know what is going on.
know what is going on. Enabling dprint() when CONFIG_TEST is enabled
means I will only need a single test.good file for output comparing.
API:
void print(string fmt, ...)
Print text to the screen
Print text to the screen.
void dprint(string fmt, ...)
Print text to the screen when debugging is enabled
Print text to the screen when debugging or testing is enabled.

View File

@ -16,7 +16,7 @@ inline void print(const char *fmt, ...)
va_end(ap);
}
#ifdef CONFIG_DEBUG
#if defined(CONFIG_DEBUG) || defined(CONFIG_TEST)
inline void dprint(const char *fmt, ...)
{
va_list ap;
@ -25,7 +25,7 @@ inline void dprint(const char *fmt, ...)
vprintf(fmt, ap);
va_end(ap);
}
#else /* CONFIG_DEBUG */
#else /* ! (CONFIG_DEBUG || CONFIG_TEST) */
inline void dprint(const char *fmt, ...) {}
#endif /* CONFIG_DEBUG */

View File

@ -4,9 +4,6 @@ Import("env", "CONFIG")
GOOD = "%s.good"
if CONFIG.DEBUG:
GOOD = "%s-debug.good"
def run_test(target, source, env):
res = str(target[0])

1
tests/basic/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
print.good

View File

@ -1,4 +1,13 @@
#!/usr/bin/python
Import("Test")
Import("Test", "CONFIG")
out = open("print.good", 'w')
if CONFIG.DEBUG == True:
out.write("%s-debug\n" % CONFIG.VERSION)
out.write("%s-debug\n" % CONFIG.VERSION)
else:
out.write("%s\n" % CONFIG.VERSION)
out.write("%s\n" % CONFIG.VERSION)
out.close()
Test("basic", "print.cpp")

View File

@ -1,2 +0,0 @@
6.0-debug
6.0-debug

View File

@ -1 +0,0 @@
6.0

View File

@ -1,3 +0,0 @@
File path is: /home/anna/.config/ocarina-test/test.file
File path is: /home/anna/.local/share/ocarina-test/test.file
File path is: /home/anna/.ocarina-test/test.file

View File

@ -1,7 +0,0 @@
Writing data to file: /home/anna/.local/share/ocarina-test/test.io
Closing file
Reading file
File version is: 0
Hello, World!
This is a multi-line file =)
a: 1, b: 2, c: 3, d: 4, e: 5

View File

@ -1,19 +0,0 @@
ERROR: NOT_OPEN is not a legal OpenMode (/home/anna/.local/share/ocarina-test/test.0)
Test 0: Passed
ERROR: File does not exist (/home/anna/.local/share/ocarina-test/test.1)
Test 1: Passed
ERROR: Cannot write to legacy files (/home/anna/.ocarina-test/test.2)
Test 2: Passed
Test 3a: Passed
ERROR: File is already open (/home/anna/.local/share/ocarina-test/test.3)
Test 3b: Passed
Test 4a: Passed
Test 4b: Passed
Test 4c: Passed
Test 5: Passed

View File

@ -1,11 +1,15 @@
ERROR: NOT_OPEN is not a legal OpenMode (/home/anna/.local/share/ocarina-test/test.0)
Test 0: Passed
ERROR: File does not exist (/home/anna/.local/share/ocarina-test/test.1)
Test 1: Passed
ERROR: Cannot write to legacy files (/home/anna/.ocarina-test/test.2)
Test 2: Passed
Test 3a: Passed
ERROR: File is already open (/home/anna/.local/share/ocarina-test/test.3)
Test 3b: Passed
Test 4a: Passed