From 90eadd647fea6e27cd61e811b6b512cdf7db0a0f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 14 Mar 2004 06:44:04 +0000 Subject: [PATCH] honor -r when writing test_file_readers files --- stepmania/src/tests/test_file_readers.cpp | 14 +++++++++++--- stepmania/src/tests/test_misc.cpp | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/stepmania/src/tests/test_file_readers.cpp b/stepmania/src/tests/test_file_readers.cpp index 51e66cd655..267f1849c0 100644 --- a/stepmania/src/tests/test_file_readers.cpp +++ b/stepmania/src/tests/test_file_readers.cpp @@ -19,13 +19,21 @@ void CreateBinaryTestFile( FILE *out, int size ) } } +extern CString g_Root; + void CreateBinaryTestFile( CString fn, int size ) { - FILE *out = fopen( fn, "w+b" ); + FILE *out = fopen( g_Root + "/" + fn, "w+b" ); CreateBinaryTestFile( out, size ); fclose( out ); RageFile f(fn); + if( !f.Open(fn) ) + { + LOG->Warn("CreateBinaryTestFile: error reopening %s: %s", fn.c_str(), f.GetError().c_str() ); + return; + } + int test = f.GetFileSize(); if( test != size ) LOG->Warn("CreateBinaryTestFile: f.GetFileSize ret %i, exp %i", test, size ); @@ -95,7 +103,7 @@ void TestText( int LineSize, bool DOS ) filename += ssprintf( ".%i", LineSize ); if( CreateTestFiles ) { - FILE *out = fopen( filename, "w+b" ); + FILE *out = fopen( g_Root + "/" + filename, "w+b" ); for( unsigned line = 0; line < NumLines; ++line ) { @@ -196,7 +204,7 @@ void TestSeek( bool relative ) { /* Output a line of text, followed by some junk, followed by binary * test data. */ - FILE *out = fopen( "test.seek", "w+b" ); + FILE *out = fopen( g_Root + "/" + "test.seek", "w+b" ); fprintf( out, "%s", TestLine.c_str() ); fprintf( out, "%s", junk.c_str() ); CreateBinaryTestFile( out, 1024 ); diff --git a/stepmania/src/tests/test_misc.cpp b/stepmania/src/tests/test_misc.cpp index 99c2c9b727..f0ee274521 100644 --- a/stepmania/src/tests/test_misc.cpp +++ b/stepmania/src/tests/test_misc.cpp @@ -4,8 +4,8 @@ #include "RageFileManager.h" #include "RageLog.h" -static CString g_Driver = "dir", g_Root = "."; -static CString argv0; +CString g_Driver = "dir", g_Root = "."; +CString argv0; void test_handle_args( int argc, char *argv[] ) {