| 133 | } |
| 134 | |
| 135 | void BatchTestMain( int argc, char* argv[] ) |
| 136 | { |
| 137 | // TODO: Allow other directories and configuration |
| 138 | #ifdef DAEDALUS_PSP |
| 139 | const char * const romdir = "host1:/"; |
| 140 | #else |
| 141 | const char * const romdir = g_DaedalusConfig.mRomsDir; |
| 142 | #endif |
| 143 | |
| 144 | bool random_order( false ); // Whether to randomise the order of processing, to help avoid hangs |
| 145 | bool update_results( false ); // Whether to update existing results |
| 146 | s32 run_id( -1 ); // New run by default |
| 147 | |
| 148 | for(int i = 1; i < argc; ++i ) |
| 149 | { |
| 150 | const char * arg( argv[i] ); |
| 151 | if( *arg == '-' ) |
| 152 | { |
| 153 | ++arg; |
| 154 | if( strcmp( arg, "rand" ) == 0 || strcmp( arg, "random" ) == 0 ) |
| 155 | { |
| 156 | random_order = true; |
| 157 | } |
| 158 | else if( strcmp( arg, "u" ) == 0 || strcmp( arg, "update" ) == 0 ) |
| 159 | { |
| 160 | update_results = true; |
| 161 | } |
| 162 | else if( strcmp( arg, "r" ) == 0 || strcmp( arg, "run" ) == 0 ) |
| 163 | { |
| 164 | if( i+1 < argc ) |
| 165 | { |
| 166 | ++i; // Consume next arg |
| 167 | run_id = atoi( argv[i] ); |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | IO::Filename batchdir; |
| 174 | Dump_GetDumpDirectory( batchdir, "batch" ); |
| 175 | |
| 176 | IO::Filename rundir; |
| 177 | if( run_id < 0 ) |
| 178 | { |
| 179 | if( !MakeRunDirectory( rundir, batchdir ) ) |
| 180 | { |
| 181 | printf( "Couldn't start a new run\n" ); |
| 182 | return; |
| 183 | } |
| 184 | } |
| 185 | else |
| 186 | { |
| 187 | SprintRunDirectory( rundir, batchdir, run_id ); |
| 188 | if( !IO::Directory::IsDirectory( rundir ) ) |
| 189 | { |
| 190 | printf( "Couldn't resume run %d\n", run_id ); |
| 191 | return; |
| 192 | } |
no test coverage detected