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:
parent
a190047648
commit
f76021be99
|
@ -1,13 +1,6 @@
|
||||||
*.o
|
*.o
|
||||||
*.swp
|
*.sw*
|
||||||
*.swo
|
#*.pyc
|
||||||
*.pyc
|
|
||||||
*.run
|
*.run
|
||||||
*.test
|
*.test
|
||||||
*.tar.gz
|
|
||||||
.*
|
|
||||||
ocarina.bin
|
|
||||||
.sconsign.dblite
|
.sconsign.dblite
|
||||||
bin/
|
|
||||||
PKGBUILD
|
|
||||||
!PKGBUILD.tmpl
|
|
||||||
|
|
|
@ -7,10 +7,12 @@ install
|
||||||
|
|
||||||
Printing: (include/print.h>
|
Printing: (include/print.h>
|
||||||
Sometimes text needs to be printed to the screen so users (or debuggers)
|
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:
|
API:
|
||||||
void print(string fmt, ...)
|
void print(string fmt, ...)
|
||||||
Print text to the screen
|
Print text to the screen.
|
||||||
void dprint(string fmt, ...)
|
void dprint(string fmt, ...)
|
||||||
Print text to the screen when debugging is enabled
|
Print text to the screen when debugging or testing is enabled.
|
||||||
|
|
|
@ -16,7 +16,7 @@ inline void print(const char *fmt, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#if defined(CONFIG_DEBUG) || defined(CONFIG_TEST)
|
||||||
inline void dprint(const char *fmt, ...)
|
inline void dprint(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -25,7 +25,7 @@ inline void dprint(const char *fmt, ...)
|
||||||
vprintf(fmt, ap);
|
vprintf(fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
#else /* CONFIG_DEBUG */
|
#else /* ! (CONFIG_DEBUG || CONFIG_TEST) */
|
||||||
inline void dprint(const char *fmt, ...) {}
|
inline void dprint(const char *fmt, ...) {}
|
||||||
#endif /* CONFIG_DEBUG */
|
#endif /* CONFIG_DEBUG */
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,6 @@ Import("env", "CONFIG")
|
||||||
|
|
||||||
|
|
||||||
GOOD = "%s.good"
|
GOOD = "%s.good"
|
||||||
if CONFIG.DEBUG:
|
|
||||||
GOOD = "%s-debug.good"
|
|
||||||
|
|
||||||
|
|
||||||
def run_test(target, source, env):
|
def run_test(target, source, env):
|
||||||
res = str(target[0])
|
res = str(target[0])
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
print.good
|
|
@ -1,4 +1,13 @@
|
||||||
#!/usr/bin/python
|
#!/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")
|
Test("basic", "print.cpp")
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
6.0-debug
|
|
||||||
6.0-debug
|
|
|
@ -1 +0,0 @@
|
||||||
6.0
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -1,11 +1,15 @@
|
||||||
|
|
||||||
|
ERROR: NOT_OPEN is not a legal OpenMode (/home/anna/.local/share/ocarina-test/test.0)
|
||||||
Test 0: Passed
|
Test 0: Passed
|
||||||
|
|
||||||
|
ERROR: File does not exist (/home/anna/.local/share/ocarina-test/test.1)
|
||||||
Test 1: Passed
|
Test 1: Passed
|
||||||
|
|
||||||
|
ERROR: Cannot write to legacy files (/home/anna/.ocarina-test/test.2)
|
||||||
Test 2: Passed
|
Test 2: Passed
|
||||||
|
|
||||||
Test 3a: Passed
|
Test 3a: Passed
|
||||||
|
ERROR: File is already open (/home/anna/.local/share/ocarina-test/test.3)
|
||||||
Test 3b: Passed
|
Test 3b: Passed
|
||||||
|
|
||||||
Test 4a: Passed
|
Test 4a: Passed
|
||||||
|
|
Loading…
Reference in New Issue