mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
Make Hydra respect -jN (#3132)
This commit is contained in:
parent
96159d189f
commit
b31f10d124
@ -1,7 +1,7 @@
|
|||||||
/* Embedded DSL for automated black-box testing of battle mechanics.
|
/* Embedded DSL for automated black-box testing of battle mechanics.
|
||||||
*
|
*
|
||||||
* To run all the tests use:
|
* To run all the tests use:
|
||||||
* make check
|
* make check -j
|
||||||
* To run specific tests, e.g. Spikes ones, use:
|
* To run specific tests, e.g. Spikes ones, use:
|
||||||
* make check TESTS='Spikes'
|
* make check TESTS='Spikes'
|
||||||
* To build a ROM (pokemerald-test.elf) that can be opened in mgba to
|
* To build a ROM (pokemerald-test.elf) that can be opened in mgba to
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
#include <regex.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -37,6 +38,8 @@
|
|||||||
#define MAX_FAILED_TESTS_TO_LIST 100
|
#define MAX_FAILED_TESTS_TO_LIST 100
|
||||||
#define MAX_TEST_LIST_BUFFER_LENGTH 256
|
#define MAX_TEST_LIST_BUFFER_LENGTH 256
|
||||||
|
|
||||||
|
#define ARRAY_COUNT(arr) (sizeof((arr)) / sizeof((arr)[0]))
|
||||||
|
|
||||||
struct Runner
|
struct Runner
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
@ -248,7 +251,29 @@ int main(int argc, char *argv[])
|
|||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nrunners = 1;
|
||||||
|
const char *makeflags = getenv("MAKEFLAGS");
|
||||||
|
if (makeflags)
|
||||||
|
{
|
||||||
|
int e;
|
||||||
|
regex_t preg;
|
||||||
|
regmatch_t pmatch[4];
|
||||||
|
if ((e = regcomp(&preg, "(^| )-j([0-9]*)($| )", REG_EXTENDED)) != 0)
|
||||||
|
{
|
||||||
|
char errbuf[256];
|
||||||
|
regerror(e, &preg, errbuf, sizeof(errbuf));
|
||||||
|
fprintf(stderr, "regcomp failed: '%s'\n", errbuf);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if (regexec(&preg, makeflags, ARRAY_COUNT(pmatch), pmatch, 0) != REG_NOMATCH)
|
||||||
|
{
|
||||||
|
if (pmatch[2].rm_so == pmatch[2].rm_eo)
|
||||||
nrunners = sysconf(_SC_NPROCESSORS_ONLN);
|
nrunners = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
|
else
|
||||||
|
sscanf(makeflags + pmatch[2].rm_so, "%d", &nrunners);
|
||||||
|
}
|
||||||
|
regfree(&preg);
|
||||||
|
}
|
||||||
if (nrunners > MAX_PROCESSES)
|
if (nrunners > MAX_PROCESSES)
|
||||||
nrunners = MAX_PROCESSES;
|
nrunners = MAX_PROCESSES;
|
||||||
runners_digits = ceil(log10(nrunners));
|
runners_digits = ceil(log10(nrunners));
|
||||||
|
Loading…
Reference in New Issue
Block a user