[Git][ghc/ghc][wip/T19626] 3 commits: Fix buffer ref
Alex D (@nineonine)
gitlab at gitlab.haskell.org
Sun Dec 18 23:33:25 UTC 2022
Alex D pushed to branch wip/T19626 at Glasgow Haskell Compiler / GHC
Commits:
f6d0153b by nineonine at 2022-12-16T22:56:44-08:00
Fix buffer ref
- - - - -
ec3987c1 by nineonine at 2022-12-16T22:57:20-08:00
remove obsolete stack allocations
- - - - -
c9197a34 by nineonine at 2022-12-18T15:33:03-08:00
Significantly simplify tests
- - - - -
7 changed files:
- rts/OptParse.c
- rts/include/rts/OptParse.h
- testsuite/tests/rts/OptParse/OptParseTest.c
- testsuite/tests/rts/OptParse/OptParseTest.stderr
- testsuite/tests/rts/OptParse/OptParseTest.stdout
- testsuite/tests/rts/OptParse/OptParseTestUtil.c
- testsuite/tests/rts/OptParse/OptParseTestUtil.h
Changes:
=====================================
rts/OptParse.c
=====================================
@@ -35,9 +35,16 @@
return NO_VAL(UNKNOWN_RTS_OPTION); \
} while (false)
+#define OUT_OF_RANGE(error, name, min, max) \
+ do { \
+ *error = true; \
+ errorBelch("error in RTS option %s: size outside allowed range (%" FMT_Word " - %" FMT_Word ")", name, (W_)min, (W_)max); \
+ return NO_VAL(UNKNOWN_RTS_OPTION); \
+ } while (false)
+
RtsFlagName
rtsFlags[] = {
- [HELP] = {SAFE, VOID, NULL, "?" , false},
+ [HELP] = {SAFE, VOID, "help", "?" , false},
[INSTALL_SIGNAL_HANDLERS] = {UNSAFE, BOOL, "install-signal-handlers", NULL, false},
[INSTALL_SEH_HANDLERS] = {UNSAFE, BOOL, "install-seh-handlers", NULL, false},
[GENERATE_STACK_TRACES] = {UNSAFE, BOOL, "generate-stack-traces", NULL, false},
@@ -51,8 +58,8 @@ rtsFlags[] = {
[EVENTLOG_FLUSH_INTERVAL] = {SAFE, DOUBLE, "eventlog-flush-interval", NULL, true},
[COPYING_GC] = {SAFE, VOID, "copying-gc", NULL, false},
[NONMOVING_GC] = {SAFE, VOID, "nonmoving-gc", NULL, false},
- [LARGE_OBJ_ALLOC_AREA] = {UNSAFE, STGWORD64, "large-object-allocation", "AL", true},
- [MIN_ALLOC_AREA] = {UNSAFE, STGWORD64, "minimum-allocation-area-size", "A", true},
+ [LARGE_OBJ_ALLOC_AREA] = {UNSAFE, STGWORD64, "large-object-allocation", "AL", true},
+ [MIN_ALLOC_AREA] = {UNSAFE, STGWORD64, "minimum-allocation-area-size", "A", true},
// #if defined(THREADED_RTS)
// #if defined(mingw32_HOST_OS)
[IO_MANAGER_THREADS] = {UNSAFE, STGWORD64, "io-manager-threads", NULL, true},
@@ -62,7 +69,7 @@ rtsFlags[] = {
// #if defined(DEBUG) && defined(THREADED_RTS)
[DEBUG_NUMA] = {SAFE, STGWORD64, "debug-numa", NULL, true},
// #endif
- [LONG_GC_SYNC] = {SAFE, DOUBLE, "long-gc-sync", NULL, false},
+ [LONG_GC_SYNC] = {SAFE, DOUBLE, "long-gc-sync", NULL, true},
[NO_AUTO_HEAP_SAMPLES] = {UNSAFE, BOOL, "no-automatic-heap-samples", NULL, false},
[NURSERY_CHUNK_SIZE] = {UNSAFE, STGWORD64, "alloc-area-chunksize", "n", true},
[GC_BELL] = {UNSAFE, VOID, "gc-bell", "B", false},
@@ -91,6 +98,7 @@ rtsFlags[] = {
[DEBUG_SPARKS] = {SAFE, VOID, "debug-sparks", "Dr", false},
[DEBUG_COMPACT] = {SAFE, VOID, "debug-compact", "DC", false},
// #endif
+ [MAX_STACK_SIZE] = {UNSAFE, STGWORD64, "max-stack-size", "K", true},
// The 'NULL' of flags. Long name just for debugging
[UNKNOWN_RTS_OPTION] = {SAFE, VOID, "UNKNOWN_RTS_OPTION", NULL, false},
};
@@ -99,7 +107,7 @@ static RtsFlagValue
parse_flag_value(RtsFlagKey i, bool isLongName, char *arg, bool *error);
static double
-parseDouble(const char *arg, bool *error)
+parseDouble(char *arg, bool *error)
{
char *endptr;
double out;
@@ -123,12 +131,44 @@ parseDouble(const char *arg, bool *error)
return out;
}
+static
+bool valid_size(char c)
+{
+ char sizes[8] = "wWgGmMkK";
+ for (int i = 0; i < 8; i++) {
+ if (sizes[i] == c) return true;
+ }
+ return false;
+}
+
+// checks if str can be pased using decodeSize
+static
+bool is_valid_size(char *str) {
+ if (str == NULL || str[0] == '\0') {
+ return false;
+ }
+ // Check for a negative sign
+ int i = 0;
+ if (str[0] == '-') {
+ i = 1;
+ }
+ // Check for digits
+ for (; str[i] != '\0'; i++) {
+ if (i == strlen(str)-1
+ && valid_size(str[i])) { return true;
+ }
+ if (!isdigit(str[i])) {
+ return false;
+ }
+ }
+ return true;
+}
static StgWord64
-decodeSize(const char *flag, uint32_t offset, StgWord64 min, StgWord64 max);
+decodeSize(char *flag, uint32_t offset, StgWord64 min, StgWord64 max, bool* error);
static int
-find_first_numeric_char(const char *s) {
+find_first_numeric_char(char *s) {
int len = strlen(s);
for (int i = 0; i < len; i++) {
if (isdigit(s[i])) {
@@ -139,7 +179,7 @@ find_first_numeric_char(const char *s) {
}
static char*
-name_from_arg(bool longName, const char* str) {
+name_from_arg(bool longName, char* str) {
ASSERT(str != NULL);
int i;
int str_len = strlen(str);
@@ -190,15 +230,17 @@ parseArg(char *arg, bool *error)
static RtsFlagValue
parse_flag_value(RtsFlagKey i, bool isLongName, char *arg0, bool *error)
{
+ // trim off hyphens
+ char* arg = isLongName ? &arg0[2] : &arg0[1];
RtsFlagName flag = rtsFlags[i];
char* name = isLongName ? flag.longName : flag.shortName;
- char *arg = isLongName ? &arg0[2] : &arg0[1];
// offset at which value can be found. Does not account for potential `=`
- int offset = isLongName ? strlen(flag.longName) : strlen(flag.shortName);
+ int offset = strlen(name);
bool isSwitch = !rtsFlags[i].valueRequired && arg[offset] == '\0';
bool hasValue = (isLongName && arg[offset] == '=' && arg[offset+1] != '\0')
|| (!isLongName && arg[offset] != '\0');
+ // debugBelch("in: %s name %s isSwitch %i hasValue %i 'arg[offset] == '\0'?: %i\n", arg0, name, isSwitch, hasValue, arg[offset] == '\0');
// missing value - return immediately
if (!isSwitch && !hasValue) UNKNOWN_RTS_OPTION(error, arg0);
if (isSwitch && hasValue) UNKNOWN_RTS_OPTION(error, arg0);
@@ -206,6 +248,9 @@ parse_flag_value(RtsFlagKey i, bool isLongName, char *arg0, bool *error)
switch (flag.valueType) {
case VOID: {
switch (i) {
+ case INFO:
+ case COPYING_GC:
+ case NONMOVING_GC:
case GC_BELL:
case USE_MARK_REGION:
// #if defined(DEBUG)
@@ -303,31 +348,45 @@ parse_flag_value(RtsFlagKey i, bool isLongName, char *arg0, bool *error)
// account for '=' that is used with long-form names
// some long-from names can have no value though so account for that as well
if (isLongName && arg[offset] == '=') offset++;
+ if (hasValue && !is_valid_size(&arg[offset])) {
+ BAD_VALUE(error, arg);
+ }
+ StgWord64 min;
+ StgWord64 max;
switch (i) {
case LARGE_OBJ_ALLOC_AREA: {
- value = decodeSize(arg, offset, 2*BLOCK_SIZE,
- HS_INT_MAX) / BLOCK_SIZE;
+ // minimum two blocks in the nursery, so that we have one
+ // to grab for allocate().
+ min = 2*BLOCK_SIZE;
+ max = HS_INT_MAX;
+ value = decodeSize(arg, offset, min, max, error);
break;
}
case MIN_ALLOC_AREA: {
// minimum two blocks in the nursery, so that we have one
// to grab for allocate().
- value = decodeSize(arg, offset, 2*BLOCK_SIZE,
- HS_INT_MAX) / BLOCK_SIZE;
+ min = 2*BLOCK_SIZE;
+ max = HS_INT_MAX;
+ value = decodeSize(arg, offset, min, max, error);
break;
}
// #if defined(THREADED_RTS)
// #if defined(mingw32_HOST_OS)
case IO_MANAGER_THREADS: {
- value = (StgWord64)strtol(arg + offset, (char **) NULL, 10);
+ // this has to be uint32_t
+ min = 0;
+ max = HS_INT_MAX;
+ value = decodeSize(arg, offset, min, max, error);
break;
}
// #endif
case NUMA: {
+ min = 0;
+ max = HS_INT_MAX;
if (isSwitch) {
value = (StgWord64)~0;
} else if (hasValue) {
- value = (StgWord64)strtol(arg + offset, (char **) NULL, 10);
+ value = decodeSize(arg, offset, min, max, error);
} else {
*error = true;
errorBelch("invalid RTS option: %s", arg0);
@@ -337,8 +396,10 @@ parse_flag_value(RtsFlagKey i, bool isLongName, char *arg0, bool *error)
// #endif
// #if defined(DEBUG) && defined(THREADED_RTS)
case DEBUG_NUMA: {
- if (isdigit(arg[offset]) && hasValue) {
- value = (StgWord64)strtol(arg + offset, (char **) NULL, 10);
+ min = 0;
+ max = MAX_NUMA_NODES;
+ if (hasValue) {
+ value = decodeSize(arg, offset, min, max, error);
} else {
UNKNOWN_RTS_OPTION(error, arg0);
}
@@ -351,11 +412,22 @@ parse_flag_value(RtsFlagKey i, bool isLongName, char *arg0, bool *error)
}
// #endif
case NURSERY_CHUNK_SIZE: {
- value = decodeSize(arg, offset, 2*BLOCK_SIZE, HS_INT_MAX)
- / BLOCK_SIZE;
+ min = 2*BLOCK_SIZE;
+ max = HS_INT_MAX;
+ value = decodeSize(arg, offset, min, max, error);
+ break;
+ }
+
+ case MAX_STACK_SIZE: {
+ min = 0;
+ max = HS_INT_MAX;
+ value = decodeSize(arg, offset, min, max, error);
break;
}
}
+ if (*error) {
+ OUT_OF_RANGE(error, arg, min, max);
+ }
return STGWORD64_VAL(i, value);
}
default: {
@@ -368,7 +440,7 @@ parse_flag_value(RtsFlagKey i, bool isLongName, char *arg0, bool *error)
* decodeSize: parse a string containing a size, like 300K or 1.2M
-------------------------------------------------------------------------- */
static StgWord64
-decodeSize(const char *flag, uint32_t offset, StgWord64 min, StgWord64 max)
+decodeSize(char *flag, uint32_t offset, StgWord64 min, StgWord64 max, bool *error)
{
char c;
const char *s;
@@ -402,8 +474,9 @@ decodeSize(const char *flag, uint32_t offset, StgWord64 min, StgWord64 max)
if (m < 0 || val < min || val > max) {
// printf doesn't like 64-bit format specs on Windows
// apparently, so fall back to unsigned long.
- errorBelch("error in RTS option %s: size outside allowed range (%" FMT_Word " - %" FMT_Word ")", flag, (W_)min, (W_)max);
- stg_exit(EXIT_FAILURE);
+ *error = true;
+ // errorBelch("error in RTS option %s: size outside allowed range (%" FMT_Word " - %" FMT_Word ")", flag, (W_)min, (W_)max);
+ // stg_exit(EXIT_FAILURE);
}
// debugBelch("------- decodeSize val: %" FMT_Word64 "\n", val);
=====================================
rts/include/rts/OptParse.h
=====================================
@@ -72,6 +72,7 @@ typedef enum _RtsFlagKey {
DEBUG_SPARKS,
DEBUG_COMPACT,
// #endif
+ MAX_STACK_SIZE,
UNKNOWN_RTS_OPTION,
} RtsFlagKey;
=====================================
testsuite/tests/rts/OptParse/OptParseTest.c
=====================================
@@ -12,252 +12,69 @@ int main (int argc, char *argv[])
printf("=== OptParseTest START ===\n");
- _TEST( "-?", HELP
- , NULL, "?"
- , VOID, SAFE, NO_VAL(HELP));
- // _FAIL_TEST("-?asfg");
+ _TEST( "-?", HELP, NO_VAL(HELP));
- _BOOL_FLAG_TEST(INSTALL_SIGNAL_HANDLERS);
- _BOOL_FLAG_TEST(INSTALL_SEH_HANDLERS);
- _BOOL_FLAG_TEST(GENERATE_STACK_TRACES);
- _BOOL_FLAG_TEST(GENERATE_CRASH_DUMPS);
- _BOOL_FLAG_TEST(NULL_EVENTLOG_WRITER);
- _BOOL_FLAG_TEST(MACHINE_READABLE);
- _BOOL_FLAG_TEST(DISABLE_OS_MEM_RET);
- _BOOL_FLAG_TEST(INTERNAL_COUNTERS);
+ BOOL_FLAG_TEST(INSTALL_SIGNAL_HANDLERS);
+ BOOL_FLAG_TEST(INSTALL_SEH_HANDLERS);
+ BOOL_FLAG_TEST(GENERATE_STACK_TRACES);
+ BOOL_FLAG_TEST(GENERATE_CRASH_DUMPS);
+ BOOL_FLAG_TEST(NULL_EVENTLOG_WRITER);
+ BOOL_FLAG_TEST(MACHINE_READABLE);
+ BOOL_FLAG_TEST(DISABLE_OS_MEM_RET);
+ BOOL_FLAG_TEST(INTERNAL_COUNTERS);
_TEST( "--io-manager=native", IO_MANAGER_FLAG
- , "io-manager", NULL
- , ENUM, UNSAFE, ENUM_VAL(IO_MANAGER_FLAG, IO_MNGR_NATIVE));
+ , ENUM_VAL(IO_MANAGER_FLAG, IO_MNGR_NATIVE));
_TEST( "--io-manager=posix", IO_MANAGER_FLAG
- , "io-manager", NULL
- , ENUM, UNSAFE, ENUM_VAL(IO_MANAGER_FLAG, IO_MNGR_POSIX));
+ , ENUM_VAL(IO_MANAGER_FLAG, IO_MNGR_POSIX));
_FAIL_TEST("--io-manager");
_FAIL_TEST("--io-manager=");
_FAIL_TEST("--io-manager=unknown-manager");
_FAIL_TEST("--io-managerlgaks");
- _TEST( "--info", INFO
- , "info", NULL
- , VOID, SAFE, NO_VAL(INFO));
-
- _TEST( "--eventlog-flush-interval=606.909", EVENTLOG_FLUSH_INTERVAL
- , "eventlog-flush-interval", NULL
- , DOUBLE, SAFE, DOUBLE_VAL(EVENTLOG_FLUSH_INTERVAL, 606.909));
- _TEST( "--eventlog-flush-interval=0.125", EVENTLOG_FLUSH_INTERVAL
- , "eventlog-flush-interval", NULL
- , DOUBLE, SAFE, DOUBLE_VAL(EVENTLOG_FLUSH_INTERVAL, 0.125));
- _FAIL_TEST("--eventlog-flush-interval");
- _FAIL_TEST("--eventlog-flush-interval=");
- _FAIL_TEST("--eventlog-flush-interval=true");
- _FAIL_TEST("--eventlog-flush-intervalysaftrweasfasf");
-
- _TEST( "--copying-gc", COPYING_GC
- , "copying-gc", NULL
- , VOID, SAFE, NO_VAL(COPYING_GC));
-
- _TEST( "--nonmoving-gc", NONMOVING_GC
- , "nonmoving-gc", NULL
- , VOID, SAFE, NO_VAL(NONMOVING_GC));
-
- _TEST( "--large-object-allocation=8193K", LARGE_OBJ_ALLOC_AREA
- , "large-object-allocation", "AL"
- , STGWORD64, UNSAFE, STGWORD64_VAL(LARGE_OBJ_ALLOC_AREA, 8389632 / BLOCK_SIZE));
- _TEST( "--large-object-allocation=2M", LARGE_OBJ_ALLOC_AREA
- , "large-object-allocation", "AL"
- , STGWORD64, UNSAFE, STGWORD64_VAL(LARGE_OBJ_ALLOC_AREA, 2097152 / BLOCK_SIZE));
- _TEST( "-AL9G", LARGE_OBJ_ALLOC_AREA
- , "large-object-allocation", "AL"
- , STGWORD64, UNSAFE, STGWORD64_VAL(LARGE_OBJ_ALLOC_AREA, 9663676416 / BLOCK_SIZE));
- _TEST( "-AL0.125G", LARGE_OBJ_ALLOC_AREA
- , "large-object-allocation", "AL"
- , STGWORD64, UNSAFE, STGWORD64_VAL(LARGE_OBJ_ALLOC_AREA, 134217728 / BLOCK_SIZE));
- _TEST( "-AL3333w", LARGE_OBJ_ALLOC_AREA
- , "large-object-allocation", "AL"
- , STGWORD64, UNSAFE, STGWORD64_VAL(LARGE_OBJ_ALLOC_AREA, 26664 / BLOCK_SIZE));
- _FAIL_TEST("-AL");
- _FAIL_TEST("--large-object-allocation");
- _FAIL_TEST("--large-object-allocation=");
-
- _TEST( "--minimum-allocation-area-size=8193K", MIN_ALLOC_AREA
- , "minimum-allocation-area-size", "A"
- , STGWORD64, UNSAFE, STGWORD64_VAL(MIN_ALLOC_AREA, 8389632 / BLOCK_SIZE));
- _TEST( "--minimum-allocation-area-size=2M", MIN_ALLOC_AREA
- , "minimum-allocation-area-size", "A"
- , STGWORD64, UNSAFE, STGWORD64_VAL(MIN_ALLOC_AREA, 2097152 / BLOCK_SIZE));
- _TEST( "-A9G", MIN_ALLOC_AREA
- , "minimum-allocation-area-size", "A"
- , STGWORD64, UNSAFE, STGWORD64_VAL(MIN_ALLOC_AREA, 9663676416 / BLOCK_SIZE));
- _TEST( "-A0.125G", MIN_ALLOC_AREA
- , "minimum-allocation-area-size", "A"
- , STGWORD64, UNSAFE, STGWORD64_VAL(MIN_ALLOC_AREA, 134217728 / BLOCK_SIZE));
- _TEST( "-A3333w", MIN_ALLOC_AREA
- , "minimum-allocation-area-size", "A"
- , STGWORD64, UNSAFE, STGWORD64_VAL(MIN_ALLOC_AREA, 26664 / BLOCK_SIZE));
- _FAIL_TEST("-A");
- _FAIL_TEST("--minimum-allocation-area-size");
- _FAIL_TEST("--minimum-allocation-area-size=");
-
- _TEST( "--io-manager-threads=1", IO_MANAGER_THREADS
- , "io-manager-threads", NULL
- , STGWORD64, UNSAFE, STGWORD64_VAL(IO_MANAGER_THREADS, 1));
- _TEST( "--io-manager-threads=1234567", IO_MANAGER_THREADS
- , "io-manager-threads", NULL
- , STGWORD64, UNSAFE, STGWORD64_VAL(IO_MANAGER_THREADS, 1234567));
- _FAIL_TEST("--io-manager-threads");
- _FAIL_TEST("--io-manager-threads=");
-
- _TEST( "--numa", NUMA
- , "numa", NULL
- , STGWORD64, SAFE, STGWORD64_VAL(NUMA, (StgWord)~0));
- _TEST( "--numa=1", NUMA
- , "numa", NULL
- , STGWORD64, SAFE, STGWORD64_VAL(NUMA, 1));
- _TEST( "--numa=1234567", NUMA
- , "numa", NULL
- , STGWORD64, SAFE, STGWORD64_VAL(NUMA, 1234567));
- _FAIL_TEST("--numa=");
-
- _TEST( "--debug-numa=1", DEBUG_NUMA
- , "debug-numa", NULL
- , STGWORD64, SAFE, STGWORD64_VAL(DEBUG_NUMA, 1));
- _TEST( "--debug-numa=8", DEBUG_NUMA
- , "debug-numa", NULL
- , STGWORD64, SAFE, STGWORD64_VAL(DEBUG_NUMA, 8));
- _FAIL_TEST("--debug-numa=999");
- _FAIL_TEST("--debug-numa999");
- _FAIL_TEST("--debug-numa=");
- _FAIL_TEST("--debug-numa");
- _FAIL_TEST("--debug-num");
-
- _TEST( "--long-gc-sync=606.909", LONG_GC_SYNC
- , "long-gc-sync", NULL
- , DOUBLE, SAFE, DOUBLE_VAL(LONG_GC_SYNC, 606.909));
- _TEST( "--long-gc-sync=0.125", LONG_GC_SYNC
- , "long-gc-sync", NULL
- , DOUBLE, SAFE, DOUBLE_VAL(LONG_GC_SYNC, 0.125));
- _FAIL_TEST("--long-gc-sync"); // this is now failure. previously it was a no-op ... ?
- _FAIL_TEST("--long-gc-sync=");
- _FAIL_TEST("--long-gc-sync=true");
- _FAIL_TEST("--long-gc-syncysaftrweasfasf");
-
- _BOOL_FLAG_TEST(NO_AUTO_HEAP_SAMPLES);
-
- _TEST( "--alloc-area-chunksize=16M", NURSERY_CHUNK_SIZE
- , "alloc-area-chunksize", "n"
- , STGWORD64, UNSAFE, STGWORD64_VAL(NURSERY_CHUNK_SIZE, 4096));
- _TEST( "-n16m", NURSERY_CHUNK_SIZE
- , "alloc-area-chunksize", "n"
- , STGWORD64, UNSAFE, STGWORD64_VAL(NURSERY_CHUNK_SIZE, 4096));
- _TEST( "--alloc-area-chunksize=1234567", NURSERY_CHUNK_SIZE
- , "alloc-area-chunksize", "n"
- , STGWORD64, UNSAFE, STGWORD64_VAL(NURSERY_CHUNK_SIZE, 301));
- _TEST( "-n1239999", NURSERY_CHUNK_SIZE
- , "alloc-area-chunksize", "n"
- , STGWORD64, UNSAFE, STGWORD64_VAL(NURSERY_CHUNK_SIZE, 302));
- _TEST( "--alloc-area-chunksize=0.225G", NURSERY_CHUNK_SIZE
- , "alloc-area-chunksize", "n"
- , STGWORD64, UNSAFE, STGWORD64_VAL(NURSERY_CHUNK_SIZE, 58982));
- _TEST( "-n99999999k", NURSERY_CHUNK_SIZE
- , "alloc-area-chunksize", "n"
- , STGWORD64, UNSAFE, STGWORD64_VAL(NURSERY_CHUNK_SIZE, 24999999));
- _TEST( "--alloc-area-chunksize=7654W", NURSERY_CHUNK_SIZE
- , "alloc-area-chunksize", "n"
- , STGWORD64, UNSAFE, STGWORD64_VAL(NURSERY_CHUNK_SIZE, 14));
- _TEST( "-n4567w", NURSERY_CHUNK_SIZE
- , "alloc-area-chunksize", "n"
- , STGWORD64, UNSAFE, STGWORD64_VAL(NURSERY_CHUNK_SIZE, 8));
- _FAIL_TEST("--alloc-area-chunksize");
- _FAIL_TEST("--alloc-area-chunksizr");
- _FAIL_TEST("--alloc-area-chunksizr=23M");
- _FAIL_TEST("--alloc-area-chunksize=");
- // _FAIL_TEST("--alloc-area-chunksize=0");
- _FAIL_TEST("-n");
- _FAIL_TEST("-n=");
- // _FAIL_TEST("-n0");
- _FAIL_TEST("-n=0");
-
- _TEST( "-B", GC_BELL
- , "gc-bell", "B"
- , VOID, UNSAFE, NO_VAL(GC_BELL));
- _TEST( "--gc-bell", GC_BELL
- , "gc-bell", "B"
- , VOID, UNSAFE, NO_VAL(GC_BELL));
- _FAIL_TEST("--gc-bell=");
- _FAIL_TEST("--gc-bell=123G");
- _FAIL_TEST("-B123G");
-
- _TEST( "--compact-gc", COMPACT_GC
- , "compact-gc", "c"
- , DOUBLE, UNSAFE, NO_VAL(COMPACT_GC));
- _TEST( "-c", COMPACT_GC
- , "compact-gc", "c"
- , DOUBLE, UNSAFE, NO_VAL(COMPACT_GC));
- _TEST( "--compact-gc=1125", COMPACT_GC
- , "compact-gc", "c"
- , DOUBLE, UNSAFE, DOUBLE_VAL(COMPACT_GC, 1125.0));
- _TEST( "-c", COMPACT_GC
- , "compact-gc", "c"
- , DOUBLE, UNSAFE, NO_VAL(COMPACT_GC));
- _FAIL_TEST("--compact-gc=");
- _FAIL_TEST("--compact-gc=blah");
-
- _TEST( "--use-mark-region", USE_MARK_REGION
- , "use-mark-region", "w"
- , VOID, UNSAFE, NO_VAL(USE_MARK_REGION));
- _TEST( "-w", USE_MARK_REGION
- , "use-mark-region", "w"
- , VOID, UNSAFE, NO_VAL(USE_MARK_REGION));
- _FAIL_TEST("--use-mark-region=");
- _FAIL_TEST("--use-mark-region=123G");
- _FAIL_TEST("--use-mark-region=false");
- _FAIL_TEST("-w3622");
-
- _TEST( "--old-gen-factor=11288", OLD_GEN_FACTOR
- , "old-gen-factor", "F"
- , DOUBLE, UNSAFE, DOUBLE_VAL(OLD_GEN_FACTOR, 11288.0));
- _TEST( "-F188", OLD_GEN_FACTOR
- , "old-gen-factor", "F"
- , DOUBLE, UNSAFE, DOUBLE_VAL(OLD_GEN_FACTOR, 188.0));
- _FAIL_TEST("--old-gen-factor");
- _FAIL_TEST("--old-gen-factor=");
- _FAIL_TEST("--old-gen-factor=blah");
- _FAIL_TEST("-F");
- _FAIL_TEST("-F=");
- _FAIL_TEST("-Fblah");
-
- _TEST( "--return-decay-factor=11288", RETURN_DECAY_FACTOR
- , "return-decay-factor", "Fd"
- , DOUBLE, UNSAFE, DOUBLE_VAL(RETURN_DECAY_FACTOR, 11288.0));
- _TEST( "-Fd188", RETURN_DECAY_FACTOR
- , "return-decay-factor", "Fd"
- , DOUBLE, UNSAFE, DOUBLE_VAL(RETURN_DECAY_FACTOR, 188.0));
- _FAIL_TEST("--return-decay-factor");
- _FAIL_TEST("--return-decay-factor=");
- _FAIL_TEST("--return-decay-factor=blah");
- _FAIL_TEST("-Fd");
- _FAIL_TEST("-Fd=");
- _FAIL_TEST("-Fdblah");
-
- _VOID_FLAG_TEST(DEBUG_SCHEDULER);
- _VOID_FLAG_TEST(DEBUG_INTERPRETER);
- _VOID_FLAG_TEST(DEBUG_WEAK);
- _VOID_FLAG_TEST(DEBUG_GCCAFS);
- _VOID_FLAG_TEST(DEBUG_GC);
- _VOID_FLAG_TEST(DEBUG_NONMOVING_GC);
- _VOID_FLAG_TEST(DEBUG_BLOCK_ALLOC);
- _VOID_FLAG_TEST(DEBUG_SANITY);
- _VOID_FLAG_TEST(DEBUG_ZERO_IN_GC);
- _VOID_FLAG_TEST(DEBUG_STABLE);
- _VOID_FLAG_TEST(DEBUG_PROF);
- _VOID_FLAG_TEST(DEBUG_LINKER);
- _VOID_FLAG_TEST(DEBUG_LINKER_VERBOSE);
- _VOID_FLAG_TEST(DEBUG_APPLY);
- _VOID_FLAG_TEST(DEBUG_STM);
- _VOID_FLAG_TEST(DEBUG_SQUEEZE);
- _VOID_FLAG_TEST(DEBUG_HPC);
- _VOID_FLAG_TEST(DEBUG_SPARKS);
- _VOID_FLAG_TEST(DEBUG_COMPACT);
+ VOID_FLAG_TEST(INFO);
+ DOUBLE_FLAG_TEST(EVENTLOG_FLUSH_INTERVAL);
+ VOID_FLAG_TEST(COPYING_GC);
+ VOID_FLAG_TEST(NONMOVING_GC);
+
+ STGWORD64_FLAG_TEST(LARGE_OBJ_ALLOC_AREA);
+ STGWORD64_FLAG_TEST(MIN_ALLOC_AREA);
+ STGWORD64_FLAG_TEST(IO_MANAGER_THREADS);
+ STGWORD64_FLAG_TEST(NUMA);
+ STGWORD64_TEST(NUMA, (StgWord64)~0, "--%s", rtsFlags[NUMA].longName);
+ NATURAL_NUM_FLAG_TEST(DEBUG_NUMA, 0, MAX_NUMA_NODES);
+ DOUBLE_FLAG_TEST(LONG_GC_SYNC);
+
+ BOOL_FLAG_TEST(NO_AUTO_HEAP_SAMPLES);
+ STGWORD64_FLAG_TEST(NURSERY_CHUNK_SIZE);
+ VOID_FLAG_TEST(GC_BELL);
+ DOUBLE_FLAG_TEST(COMPACT_GC);
+ VOID_FLAG_TEST(USE_MARK_REGION);
+ DOUBLE_FLAG_TEST(OLD_GEN_FACTOR);
+ DOUBLE_FLAG_TEST(RETURN_DECAY_FACTOR);
+ DOUBLE_FLAG_TEST(RETURN_DECAY_FACTOR);
+
+ VOID_FLAG_TEST(DEBUG_SCHEDULER);
+ VOID_FLAG_TEST(DEBUG_INTERPRETER);
+ VOID_FLAG_TEST(DEBUG_WEAK);
+ VOID_FLAG_TEST(DEBUG_GCCAFS);
+ VOID_FLAG_TEST(DEBUG_GC);
+ VOID_FLAG_TEST(DEBUG_NONMOVING_GC);
+ VOID_FLAG_TEST(DEBUG_BLOCK_ALLOC);
+ VOID_FLAG_TEST(DEBUG_SANITY);
+ VOID_FLAG_TEST(DEBUG_ZERO_IN_GC);
+ VOID_FLAG_TEST(DEBUG_STABLE);
+ VOID_FLAG_TEST(DEBUG_PROF);
+ VOID_FLAG_TEST(DEBUG_LINKER);
+ VOID_FLAG_TEST(DEBUG_LINKER_VERBOSE);
+ VOID_FLAG_TEST(DEBUG_APPLY);
+ VOID_FLAG_TEST(DEBUG_STM);
+ VOID_FLAG_TEST(DEBUG_SQUEEZE);
+ VOID_FLAG_TEST(DEBUG_HPC);
+ VOID_FLAG_TEST(DEBUG_SPARKS);
+ VOID_FLAG_TEST(DEBUG_COMPACT);
+
+ STGWORD64_FLAG_TEST(MAX_STACK_SIZE);
printf("\n=== OptParseTest END ===\n");
return 0;
=====================================
testsuite/tests/rts/OptParse/OptParseTest.stderr
=====================================
@@ -1,6 +1,6 @@
(TEST) input: -?
-0: (null) ? SAFE
+0: help ? SAFE
(TEST) input: --install-signal-handlers
1: install-signal-handlers (null) UNSAFE
@@ -191,161 +191,377 @@ unknown RTS option: --io-managerlgaks
(TEST) input: --info
10: info (null) SAFE
-(TEST) input: --eventlog-flush-interval=606.909
+(FAIL_TEST) input: -info=
+unknown RTS option: -info=
+
+(FAIL_TEST) input: --info=123G
+flag info given an argument when none was expected: --info=123G
+
+(FAIL_TEST) input: --info=false
+flag info given an argument when none was expected: --info=false
+
+(FAIL_TEST) input: --info=true
+flag info given an argument when none was expected: --info=true
+
+(TEST) input: --eventlog-flush-interval=1125
11: eventlog-flush-interval (null) SAFE
-expected: 606.909000 actual: 606.909000
+expected: 1125.000000 actual: 1125.000000
-(TEST) input: --eventlog-flush-interval=0.125
+(TEST) input: --eventlog-flush-interval=909.909
11: eventlog-flush-interval (null) SAFE
-expected: 0.125000 actual: 0.125000
+expected: 909.909000 actual: 909.909000
-(FAIL_TEST) input: --eventlog-flush-interval
-unknown RTS option: --eventlog-flush-interval
+(TEST) input: --eventlog-flush-interval=0.00567
+11: eventlog-flush-interval (null) SAFE
+expected: 0.005670 actual: 0.005670
(FAIL_TEST) input: --eventlog-flush-interval=
unknown RTS option: --eventlog-flush-interval=
+(FAIL_TEST) input: --eventlog-flush-interval=bar
+bad value for eventlog-flush-interval=bar
+
+(FAIL_TEST) input: --eventlog-flush-interval=false
+bad value for eventlog-flush-interval=false
+
(FAIL_TEST) input: --eventlog-flush-interval=true
bad value for eventlog-flush-interval=true
-(FAIL_TEST) input: --eventlog-flush-intervalysaftrweasfasf
-unknown RTS option: --eventlog-flush-intervalysaftrweasfasf
+(FAIL_TEST) input: --eventlog-flush-intervalxxzag
+unknown RTS option: --eventlog-flush-intervalxxzag
(TEST) input: --copying-gc
12: copying-gc (null) SAFE
+(FAIL_TEST) input: -copying-gc=
+unknown RTS option: -copying-gc=
+
+(FAIL_TEST) input: --copying-gc=123G
+flag copying-gc given an argument when none was expected: --copying-gc=123G
+
+(FAIL_TEST) input: --copying-gc=false
+flag copying-gc given an argument when none was expected: --copying-gc=false
+
+(FAIL_TEST) input: --copying-gc=true
+flag copying-gc given an argument when none was expected: --copying-gc=true
+
(TEST) input: --nonmoving-gc
13: nonmoving-gc (null) SAFE
+(FAIL_TEST) input: -nonmoving-gc=
+unknown RTS option: -nonmoving-gc=
+
+(FAIL_TEST) input: --nonmoving-gc=123G
+flag nonmoving-gc given an argument when none was expected: --nonmoving-gc=123G
+
+(FAIL_TEST) input: --nonmoving-gc=false
+flag nonmoving-gc given an argument when none was expected: --nonmoving-gc=false
+
+(FAIL_TEST) input: --nonmoving-gc=true
+flag nonmoving-gc given an argument when none was expected: --nonmoving-gc=true
+
+(TEST) input: --large-object-allocation=8193
+14: large-object-allocation AL UNSAFE
+expected: 8193 actual: 8193
+
(TEST) input: --large-object-allocation=8193K
14: large-object-allocation AL UNSAFE
-expected: 2048 actual: 2048
+expected: 8389632 actual: 8389632
(TEST) input: --large-object-allocation=2M
14: large-object-allocation AL UNSAFE
-expected: 512 actual: 512
+expected: 2097152 actual: 2097152
+
+(TEST) input: --large-object-allocation=9G
+14: large-object-allocation AL UNSAFE
+expected: 9663676416 actual: 9663676416
-(TEST) input: -AL9G
+(TEST) input: --large-object-allocation=2G
14: large-object-allocation AL UNSAFE
-expected: 2359296 actual: 2359296
+expected: 2147483648 actual: 2147483648
-(TEST) input: -AL0.125G
+(TEST) input: --large-object-allocation=3333w
14: large-object-allocation AL UNSAFE
-expected: 32768 actual: 32768
+expected: 26664 actual: 26664
+
+(FAIL_TEST) input: --large-object-allocation=
+unknown RTS option: --large-object-allocation=
+
+(FAIL_TEST) input: --large-object-allocation=fbar
+bad value for large-object-allocation=fbar
+
+(FAIL_TEST) input: --large-object-allocation=false
+bad value for large-object-allocation=false
+
+(FAIL_TEST) input: --large-object-allocation=true
+bad value for large-object-allocation=true
+
+(FAIL_TEST) input: --large-object-allocationxxzag
+unknown RTS option: --large-object-allocationxxzag
+
+(TEST) input: -AL8193
+14: large-object-allocation AL UNSAFE
+expected: 8193 actual: 8193
+
+(TEST) input: -AL8193k
+14: large-object-allocation AL UNSAFE
+expected: 8389632 actual: 8389632
+
+(TEST) input: -AL2m
+14: large-object-allocation AL UNSAFE
+expected: 2097152 actual: 2097152
+
+(TEST) input: -AL9g
+14: large-object-allocation AL UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: -AL1G
+14: large-object-allocation AL UNSAFE
+expected: 1073741824 actual: 1073741824
(TEST) input: -AL3333w
14: large-object-allocation AL UNSAFE
-expected: 6 actual: 6
+expected: 26664 actual: 26664
-(FAIL_TEST) input: -AL
-unknown RTS option: -AL
+(FAIL_TEST) input: -AL=
+unknown RTS option: -AL=
-(FAIL_TEST) input: --large-object-allocation
-unknown RTS option: --large-object-allocation
+(FAIL_TEST) input: -AL=baz
+unknown RTS option: -AL=baz
-(FAIL_TEST) input: --large-object-allocation=
-unknown RTS option: --large-object-allocation=
+(FAIL_TEST) input: -AL=false
+unknown RTS option: -AL=false
+
+(FAIL_TEST) input: -AL=true
+unknown RTS option: -AL=true
+
+(FAIL_TEST) input: -ALjhgl
+unknown RTS option: -ALjhgl
+
+(TEST) input: --minimum-allocation-area-size=8193
+15: minimum-allocation-area-size A UNSAFE
+expected: 8193 actual: 8193
(TEST) input: --minimum-allocation-area-size=8193K
15: minimum-allocation-area-size A UNSAFE
-expected: 2048 actual: 2048
+expected: 8389632 actual: 8389632
(TEST) input: --minimum-allocation-area-size=2M
15: minimum-allocation-area-size A UNSAFE
-expected: 512 actual: 512
+expected: 2097152 actual: 2097152
+
+(TEST) input: --minimum-allocation-area-size=9G
+15: minimum-allocation-area-size A UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: --minimum-allocation-area-size=2G
+15: minimum-allocation-area-size A UNSAFE
+expected: 2147483648 actual: 2147483648
+
+(TEST) input: --minimum-allocation-area-size=3333w
+15: minimum-allocation-area-size A UNSAFE
+expected: 26664 actual: 26664
+
+(FAIL_TEST) input: --minimum-allocation-area-size=
+unknown RTS option: --minimum-allocation-area-size=
+
+(FAIL_TEST) input: --minimum-allocation-area-size=fbar
+bad value for minimum-allocation-area-size=fbar
+
+(FAIL_TEST) input: --minimum-allocation-area-size=false
+bad value for minimum-allocation-area-size=false
+
+(FAIL_TEST) input: --minimum-allocation-area-size=true
+bad value for minimum-allocation-area-size=true
+
+(FAIL_TEST) input: --minimum-allocation-area-sizexxzag
+unknown RTS option: --minimum-allocation-area-sizexxzag
-(TEST) input: -A9G
+(TEST) input: -A8193
15: minimum-allocation-area-size A UNSAFE
-expected: 2359296 actual: 2359296
+expected: 8193 actual: 8193
-(TEST) input: -A0.125G
+(TEST) input: -A8193k
15: minimum-allocation-area-size A UNSAFE
-expected: 32768 actual: 32768
+expected: 8389632 actual: 8389632
+
+(TEST) input: -A2m
+15: minimum-allocation-area-size A UNSAFE
+expected: 2097152 actual: 2097152
+
+(TEST) input: -A9g
+15: minimum-allocation-area-size A UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: -A1G
+15: minimum-allocation-area-size A UNSAFE
+expected: 1073741824 actual: 1073741824
(TEST) input: -A3333w
15: minimum-allocation-area-size A UNSAFE
-expected: 6 actual: 6
+expected: 26664 actual: 26664
-(FAIL_TEST) input: -A
-unknown RTS option: -A
+(FAIL_TEST) input: -A=
+unknown RTS option: -A=
-(FAIL_TEST) input: --minimum-allocation-area-size
-unknown RTS option: --minimum-allocation-area-size
+(FAIL_TEST) input: -A=baz
+unknown RTS option: -A=baz
-(FAIL_TEST) input: --minimum-allocation-area-size=
-unknown RTS option: --minimum-allocation-area-size=
+(FAIL_TEST) input: -A=false
+unknown RTS option: -A=false
+
+(FAIL_TEST) input: -A=true
+unknown RTS option: -A=true
-(TEST) input: --io-manager-threads=1
+(FAIL_TEST) input: -Ajhgl
+unknown RTS option: -Ajhgl
+
+(TEST) input: --io-manager-threads=8193
17: io-manager-threads (null) UNSAFE
-expected: 1 actual: 1
+expected: 8193 actual: 8193
-(TEST) input: --io-manager-threads=1234567
+(TEST) input: --io-manager-threads=8193K
17: io-manager-threads (null) UNSAFE
-expected: 1234567 actual: 1234567
+expected: 8389632 actual: 8389632
-(FAIL_TEST) input: --io-manager-threads
-unknown RTS option: --io-manager-threads
+(TEST) input: --io-manager-threads=2M
+17: io-manager-threads (null) UNSAFE
+expected: 2097152 actual: 2097152
+
+(TEST) input: --io-manager-threads=9G
+17: io-manager-threads (null) UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: --io-manager-threads=2G
+17: io-manager-threads (null) UNSAFE
+expected: 2147483648 actual: 2147483648
+
+(TEST) input: --io-manager-threads=3333w
+17: io-manager-threads (null) UNSAFE
+expected: 26664 actual: 26664
(FAIL_TEST) input: --io-manager-threads=
unknown RTS option: --io-manager-threads=
-(TEST) input: --numa
+(FAIL_TEST) input: --io-manager-threads=fbar
+bad value for io-manager-threads=fbar
+
+(FAIL_TEST) input: --io-manager-threads=false
+bad value for io-manager-threads=false
+
+(FAIL_TEST) input: --io-manager-threads=true
+bad value for io-manager-threads=true
+
+(FAIL_TEST) input: --io-manager-threadsxxzag
+unknown RTS option: --io-manager-threadsxxzag
+
+(TEST) input: --numa=8193
18: numa (null) SAFE
-expected: 18446744073709551615 actual: 18446744073709551615
+expected: 8193 actual: 8193
-(TEST) input: --numa=1
+(TEST) input: --numa=8193K
18: numa (null) SAFE
-expected: 1 actual: 1
+expected: 8389632 actual: 8389632
-(TEST) input: --numa=1234567
+(TEST) input: --numa=2M
18: numa (null) SAFE
-expected: 1234567 actual: 1234567
+expected: 2097152 actual: 2097152
+
+(TEST) input: --numa=9G
+18: numa (null) SAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: --numa=2G
+18: numa (null) SAFE
+expected: 2147483648 actual: 2147483648
+
+(TEST) input: --numa=3333w
+18: numa (null) SAFE
+expected: 26664 actual: 26664
(FAIL_TEST) input: --numa=
unknown RTS option: --numa=
+(FAIL_TEST) input: --numa=fbar
+bad value for numa=fbar
+
+(FAIL_TEST) input: --numa=false
+bad value for numa=false
+
+(FAIL_TEST) input: --numa=true
+bad value for numa=true
+
+(FAIL_TEST) input: --numaxxzag
+unknown RTS option: --numaxxzag
+
+(TEST) input: --numa
+18: numa (null) SAFE
+expected: 18446744073709551615 actual: 18446744073709551615
+
+(TEST) input: --debug-numa=0
+19: debug-numa (null) SAFE
+expected: 0 actual: 0
+
+(TEST) input: --debug-numa=16
+19: debug-numa (null) SAFE
+expected: 16 actual: 16
+
(TEST) input: --debug-numa=1
19: debug-numa (null) SAFE
expected: 1 actual: 1
-(TEST) input: --debug-numa=8
+(TEST) input: --debug-numa=11
19: debug-numa (null) SAFE
-expected: 8 actual: 8
+expected: 11 actual: 11
-(FAIL_TEST) input: --debug-numa=999
-debug-numa: Too many NUMA nodes (max 16)
+(FAIL_TEST) input: --debug-numa=-1
+error in RTS option debug-numa=-1: size outside allowed range (0 - 16)
-(FAIL_TEST) input: --debug-numa999
-unknown RTS option: --debug-numa999
+(FAIL_TEST) input: --debug-numa=17
+debug-numa: Too many NUMA nodes (max 16)
+error in RTS option debug-numa=17: size outside allowed range (0 - 16)
(FAIL_TEST) input: --debug-numa=
unknown RTS option: --debug-numa=
-(FAIL_TEST) input: --debug-numa
-unknown RTS option: --debug-numa
+(FAIL_TEST) input: --debug-numa=fbar
+bad value for debug-numa=fbar
-(FAIL_TEST) input: --debug-num
-unknown RTS option: --debug-num
+(FAIL_TEST) input: --debug-numa=false
+bad value for debug-numa=false
-(TEST) input: --long-gc-sync=606.909
+(FAIL_TEST) input: --debug-numa=true
+bad value for debug-numa=true
+
+(FAIL_TEST) input: --debug-numaxxzag
+unknown RTS option: --debug-numaxxzag
+
+(TEST) input: --long-gc-sync=1125
20: long-gc-sync (null) SAFE
-expected: 606.909000 actual: 606.909000
+expected: 1125.000000 actual: 1125.000000
-(TEST) input: --long-gc-sync=0.125
+(TEST) input: --long-gc-sync=909.909
20: long-gc-sync (null) SAFE
-expected: 0.125000 actual: 0.125000
+expected: 909.909000 actual: 909.909000
-(FAIL_TEST) input: --long-gc-sync
-bad value for long-gc-sync
+(TEST) input: --long-gc-sync=0.00567
+20: long-gc-sync (null) SAFE
+expected: 0.005670 actual: 0.005670
(FAIL_TEST) input: --long-gc-sync=
unknown RTS option: --long-gc-sync=
+(FAIL_TEST) input: --long-gc-sync=bar
+bad value for long-gc-sync=bar
+
+(FAIL_TEST) input: --long-gc-sync=false
+bad value for long-gc-sync=false
+
(FAIL_TEST) input: --long-gc-sync=true
bad value for long-gc-sync=true
-(FAIL_TEST) input: --long-gc-syncysaftrweasfasf
-unknown RTS option: --long-gc-syncysaftrweasfasf
+(FAIL_TEST) input: --long-gc-syncxxzag
+unknown RTS option: --long-gc-syncxxzag
(TEST) input: --no-automatic-heap-samples
21: no-automatic-heap-samples (null) UNSAFE
@@ -368,79 +584,124 @@ unknown RTS option: --no-automatic-heap-samples=1
(FAIL_TEST) input: --no-automatic-heap-samplesjhgl
unknown RTS option: --no-automatic-heap-samplesjhgl
-(TEST) input: --alloc-area-chunksize=16M
+(TEST) input: --alloc-area-chunksize=8193
22: alloc-area-chunksize n UNSAFE
-expected: 4096 actual: 4096
+expected: 8193 actual: 8193
-(TEST) input: -n16m
+(TEST) input: --alloc-area-chunksize=8193K
22: alloc-area-chunksize n UNSAFE
-expected: 4096 actual: 4096
+expected: 8389632 actual: 8389632
-(TEST) input: --alloc-area-chunksize=1234567
+(TEST) input: --alloc-area-chunksize=2M
22: alloc-area-chunksize n UNSAFE
-expected: 301 actual: 301
+expected: 2097152 actual: 2097152
-(TEST) input: -n1239999
+(TEST) input: --alloc-area-chunksize=9G
22: alloc-area-chunksize n UNSAFE
-expected: 302 actual: 302
+expected: 9663676416 actual: 9663676416
-(TEST) input: --alloc-area-chunksize=0.225G
+(TEST) input: --alloc-area-chunksize=2G
22: alloc-area-chunksize n UNSAFE
-expected: 58982 actual: 58982
+expected: 2147483648 actual: 2147483648
-(TEST) input: -n99999999k
+(TEST) input: --alloc-area-chunksize=3333w
22: alloc-area-chunksize n UNSAFE
-expected: 24999999 actual: 24999999
+expected: 26664 actual: 26664
-(TEST) input: --alloc-area-chunksize=7654W
-22: alloc-area-chunksize n UNSAFE
-expected: 14 actual: 14
+(FAIL_TEST) input: --alloc-area-chunksize=
+unknown RTS option: --alloc-area-chunksize=
+
+(FAIL_TEST) input: --alloc-area-chunksize=fbar
+bad value for alloc-area-chunksize=fbar
-(TEST) input: -n4567w
+(FAIL_TEST) input: --alloc-area-chunksize=false
+bad value for alloc-area-chunksize=false
+
+(FAIL_TEST) input: --alloc-area-chunksize=true
+bad value for alloc-area-chunksize=true
+
+(FAIL_TEST) input: --alloc-area-chunksizexxzag
+unknown RTS option: --alloc-area-chunksizexxzag
+
+(TEST) input: -n8193
22: alloc-area-chunksize n UNSAFE
-expected: 8 actual: 8
+expected: 8193 actual: 8193
-(FAIL_TEST) input: --alloc-area-chunksize
-unknown RTS option: --alloc-area-chunksize
+(TEST) input: -n8193k
+22: alloc-area-chunksize n UNSAFE
+expected: 8389632 actual: 8389632
-(FAIL_TEST) input: --alloc-area-chunksizr
-unknown RTS option: --alloc-area-chunksizr
+(TEST) input: -n2m
+22: alloc-area-chunksize n UNSAFE
+expected: 2097152 actual: 2097152
-(FAIL_TEST) input: --alloc-area-chunksizr=23M
-unknown RTS option: --alloc-area-chunksizr=23M
+(TEST) input: -n9g
+22: alloc-area-chunksize n UNSAFE
+expected: 9663676416 actual: 9663676416
-(FAIL_TEST) input: --alloc-area-chunksize=
-unknown RTS option: --alloc-area-chunksize=
+(TEST) input: -n1G
+22: alloc-area-chunksize n UNSAFE
+expected: 1073741824 actual: 1073741824
-(FAIL_TEST) input: -n
-unknown RTS option: -n
+(TEST) input: -n3333w
+22: alloc-area-chunksize n UNSAFE
+expected: 26664 actual: 26664
(FAIL_TEST) input: -n=
unknown RTS option: -n=
-(FAIL_TEST) input: -n=0
-unknown RTS option: -n=0
+(FAIL_TEST) input: -n=baz
+unknown RTS option: -n=baz
-(TEST) input: -B
-16: gc-bell B UNSAFE
+(FAIL_TEST) input: -n=false
+unknown RTS option: -n=false
+
+(FAIL_TEST) input: -n=true
+unknown RTS option: -n=true
+
+(FAIL_TEST) input: -njhgl
+unknown RTS option: -njhgl
(TEST) input: --gc-bell
16: gc-bell B UNSAFE
-(FAIL_TEST) input: --gc-bell=
-unknown RTS option: --gc-bell=
+(FAIL_TEST) input: -gc-bell=
+unknown RTS option: -gc-bell=
(FAIL_TEST) input: --gc-bell=123G
flag gc-bell given an argument when none was expected: --gc-bell=123G
-(FAIL_TEST) input: -B123G
-flag B given an argument when none was expected: -B123G
+(FAIL_TEST) input: --gc-bell=false
+flag gc-bell given an argument when none was expected: --gc-bell=false
-(TEST) input: --compact-gc
-23: compact-gc c UNSAFE
-expected: 0.000000 actual: 0.000000
+(FAIL_TEST) input: --gc-bell=true
+flag gc-bell given an argument when none was expected: --gc-bell=true
-(TEST) input: -c
+(TEST) input: -B
+16: gc-bell B UNSAFE
+
+(FAIL_TEST) input: -B=
+unknown RTS option: -B=
+
+(FAIL_TEST) input: -B3621
+flag B given an argument when none was expected: -B3621
+
+(FAIL_TEST) input: -B=3622
+unknown RTS option: -B=3622
+
+(FAIL_TEST) input: -B=true
+unknown RTS option: -B=true
+
+(FAIL_TEST) input: -B=
+unknown RTS option: -B=
+
+(FAIL_TEST) input: -B3622
+flag B given an argument when none was expected: -B3622
+
+(FAIL_TEST) input: -B=3600
+unknown RTS option: -B=3600
+
+(TEST) input: --compact-gc
23: compact-gc c UNSAFE
expected: 0.000000 actual: 0.000000
@@ -448,24 +709,58 @@ expected: 0.000000 actual: 0.000000
23: compact-gc c UNSAFE
expected: 1125.000000 actual: 1125.000000
-(TEST) input: -c
+(TEST) input: --compact-gc=909.909
23: compact-gc c UNSAFE
-expected: 0.000000 actual: 0.000000
+expected: 909.909000 actual: 909.909000
+
+(TEST) input: --compact-gc=0.00567
+23: compact-gc c UNSAFE
+expected: 0.005670 actual: 0.005670
(FAIL_TEST) input: --compact-gc=
unknown RTS option: --compact-gc=
-(FAIL_TEST) input: --compact-gc=blah
-bad value for compact-gc=blah
+(FAIL_TEST) input: --compact-gc=bar
+bad value for compact-gc=bar
-(TEST) input: --use-mark-region
-24: use-mark-region w UNSAFE
+(FAIL_TEST) input: --compact-gc=false
+bad value for compact-gc=false
-(TEST) input: -w
+(FAIL_TEST) input: --compact-gc=true
+bad value for compact-gc=true
+
+(FAIL_TEST) input: --compact-gcxxzag
+unknown RTS option: --compact-gcxxzag
+
+(TEST) input: -c
+23: compact-gc c UNSAFE
+expected: 0.000000 actual: 0.000000
+
+(TEST) input: -c0.125
+23: compact-gc c UNSAFE
+expected: 0.125000 actual: 0.125000
+
+(TEST) input: -c707.76
+23: compact-gc c UNSAFE
+expected: 707.760000 actual: 707.760000
+
+(FAIL_TEST) input: -c=
+unknown RTS option: -c=
+
+(FAIL_TEST) input: -c=foo
+unknown RTS option: -c=foo
+
+(FAIL_TEST) input: -c=false
+unknown RTS option: -c=false
+
+(FAIL_TEST) input: -c=true
+unknown RTS option: -c=true
+
+(TEST) input: --use-mark-region
24: use-mark-region w UNSAFE
-(FAIL_TEST) input: --use-mark-region=
-unknown RTS option: --use-mark-region=
+(FAIL_TEST) input: -use-mark-region=
+unknown RTS option: -use-mark-region=
(FAIL_TEST) input: --use-mark-region=123G
flag use-mark-region given an argument when none was expected: --use-mark-region=123G
@@ -473,65 +768,175 @@ flag use-mark-region given an argument when none was expected: --use-mark-region
(FAIL_TEST) input: --use-mark-region=false
flag use-mark-region given an argument when none was expected: --use-mark-region=false
+(FAIL_TEST) input: --use-mark-region=true
+flag use-mark-region given an argument when none was expected: --use-mark-region=true
+
+(TEST) input: -w
+24: use-mark-region w UNSAFE
+
+(FAIL_TEST) input: -w=
+unknown RTS option: -w=
+
+(FAIL_TEST) input: -w3621
+flag w given an argument when none was expected: -w3621
+
+(FAIL_TEST) input: -w=3622
+unknown RTS option: -w=3622
+
+(FAIL_TEST) input: -w=true
+unknown RTS option: -w=true
+
+(FAIL_TEST) input: -w=
+unknown RTS option: -w=
+
(FAIL_TEST) input: -w3622
flag w given an argument when none was expected: -w3622
-(TEST) input: --old-gen-factor=11288
+(FAIL_TEST) input: -w=3600
+unknown RTS option: -w=3600
+
+(TEST) input: --old-gen-factor=1125
25: old-gen-factor F UNSAFE
-expected: 11288.000000 actual: 11288.000000
+expected: 1125.000000 actual: 1125.000000
-(TEST) input: -F188
+(TEST) input: --old-gen-factor=909.909
25: old-gen-factor F UNSAFE
-expected: 188.000000 actual: 188.000000
+expected: 909.909000 actual: 909.909000
-(FAIL_TEST) input: --old-gen-factor
-unknown RTS option: --old-gen-factor
+(TEST) input: --old-gen-factor=0.00567
+25: old-gen-factor F UNSAFE
+expected: 0.005670 actual: 0.005670
(FAIL_TEST) input: --old-gen-factor=
unknown RTS option: --old-gen-factor=
-(FAIL_TEST) input: --old-gen-factor=blah
-bad value for old-gen-factor=blah
+(FAIL_TEST) input: --old-gen-factor=bar
+bad value for old-gen-factor=bar
+
+(FAIL_TEST) input: --old-gen-factor=false
+bad value for old-gen-factor=false
+
+(FAIL_TEST) input: --old-gen-factor=true
+bad value for old-gen-factor=true
-(FAIL_TEST) input: -F
-unknown RTS option: -F
+(FAIL_TEST) input: --old-gen-factorxxzag
+unknown RTS option: --old-gen-factorxxzag
+
+(TEST) input: -F0.125
+25: old-gen-factor F UNSAFE
+expected: 0.125000 actual: 0.125000
+
+(TEST) input: -F707.76
+25: old-gen-factor F UNSAFE
+expected: 707.760000 actual: 707.760000
(FAIL_TEST) input: -F=
unknown RTS option: -F=
-(FAIL_TEST) input: -Fblah
-unknown RTS option: -Fblah
+(FAIL_TEST) input: -F=foo
+unknown RTS option: -F=foo
+
+(FAIL_TEST) input: -F=false
+unknown RTS option: -F=false
-(TEST) input: --return-decay-factor=11288
+(FAIL_TEST) input: -F=true
+unknown RTS option: -F=true
+
+(TEST) input: --return-decay-factor=1125
26: return-decay-factor Fd UNSAFE
-expected: 11288.000000 actual: 11288.000000
+expected: 1125.000000 actual: 1125.000000
-(TEST) input: -Fd188
+(TEST) input: --return-decay-factor=909.909
26: return-decay-factor Fd UNSAFE
-expected: 188.000000 actual: 188.000000
+expected: 909.909000 actual: 909.909000
-(FAIL_TEST) input: --return-decay-factor
-unknown RTS option: --return-decay-factor
+(TEST) input: --return-decay-factor=0.00567
+26: return-decay-factor Fd UNSAFE
+expected: 0.005670 actual: 0.005670
(FAIL_TEST) input: --return-decay-factor=
unknown RTS option: --return-decay-factor=
-(FAIL_TEST) input: --return-decay-factor=blah
-bad value for return-decay-factor=blah
+(FAIL_TEST) input: --return-decay-factor=bar
+bad value for return-decay-factor=bar
-(FAIL_TEST) input: -Fd
-unknown RTS option: -Fd
+(FAIL_TEST) input: --return-decay-factor=false
+bad value for return-decay-factor=false
+
+(FAIL_TEST) input: --return-decay-factor=true
+bad value for return-decay-factor=true
+
+(FAIL_TEST) input: --return-decay-factorxxzag
+unknown RTS option: --return-decay-factorxxzag
+
+(TEST) input: -Fd0.125
+26: return-decay-factor Fd UNSAFE
+expected: 0.125000 actual: 0.125000
+
+(TEST) input: -Fd707.76
+26: return-decay-factor Fd UNSAFE
+expected: 707.760000 actual: 707.760000
(FAIL_TEST) input: -Fd=
unknown RTS option: -Fd=
-(FAIL_TEST) input: -Fdblah
-unknown RTS option: -Fdblah
+(FAIL_TEST) input: -Fd=foo
+unknown RTS option: -Fd=foo
-(TEST) input: --debug-scheduler
-27: debug-scheduler Ds SAFE
+(FAIL_TEST) input: -Fd=false
+unknown RTS option: -Fd=false
-(TEST) input: -Ds
+(FAIL_TEST) input: -Fd=true
+unknown RTS option: -Fd=true
+
+(TEST) input: --return-decay-factor=1125
+26: return-decay-factor Fd UNSAFE
+expected: 1125.000000 actual: 1125.000000
+
+(TEST) input: --return-decay-factor=909.909
+26: return-decay-factor Fd UNSAFE
+expected: 909.909000 actual: 909.909000
+
+(TEST) input: --return-decay-factor=0.00567
+26: return-decay-factor Fd UNSAFE
+expected: 0.005670 actual: 0.005670
+
+(FAIL_TEST) input: --return-decay-factor=
+unknown RTS option: --return-decay-factor=
+
+(FAIL_TEST) input: --return-decay-factor=bar
+bad value for return-decay-factor=bar
+
+(FAIL_TEST) input: --return-decay-factor=false
+bad value for return-decay-factor=false
+
+(FAIL_TEST) input: --return-decay-factor=true
+bad value for return-decay-factor=true
+
+(FAIL_TEST) input: --return-decay-factorxxzag
+unknown RTS option: --return-decay-factorxxzag
+
+(TEST) input: -Fd0.125
+26: return-decay-factor Fd UNSAFE
+expected: 0.125000 actual: 0.125000
+
+(TEST) input: -Fd707.76
+26: return-decay-factor Fd UNSAFE
+expected: 707.760000 actual: 707.760000
+
+(FAIL_TEST) input: -Fd=
+unknown RTS option: -Fd=
+
+(FAIL_TEST) input: -Fd=foo
+unknown RTS option: -Fd=foo
+
+(FAIL_TEST) input: -Fd=false
+unknown RTS option: -Fd=false
+
+(FAIL_TEST) input: -Fd=true
+unknown RTS option: -Fd=true
+
+(TEST) input: --debug-scheduler
27: debug-scheduler Ds SAFE
(FAIL_TEST) input: -debug-scheduler=
@@ -546,6 +951,9 @@ flag debug-scheduler given an argument when none was expected: --debug-scheduler
(FAIL_TEST) input: --debug-scheduler=true
flag debug-scheduler given an argument when none was expected: --debug-scheduler=true
+(TEST) input: -Ds
+27: debug-scheduler Ds SAFE
+
(FAIL_TEST) input: -Ds=
unknown RTS option: -Ds=
@@ -570,9 +978,6 @@ unknown RTS option: -Ds=3600
(TEST) input: --debug-interpreter
28: debug-interpreter Di SAFE
-(TEST) input: -Di
-28: debug-interpreter Di SAFE
-
(FAIL_TEST) input: -debug-interpreter=
unknown RTS option: -debug-interpreter=
@@ -585,6 +990,9 @@ flag debug-interpreter given an argument when none was expected: --debug-interpr
(FAIL_TEST) input: --debug-interpreter=true
flag debug-interpreter given an argument when none was expected: --debug-interpreter=true
+(TEST) input: -Di
+28: debug-interpreter Di SAFE
+
(FAIL_TEST) input: -Di=
unknown RTS option: -Di=
@@ -609,9 +1017,6 @@ unknown RTS option: -Di=3600
(TEST) input: --debug-weak
29: debug-weak Dw SAFE
-(TEST) input: -Dw
-29: debug-weak Dw SAFE
-
(FAIL_TEST) input: -debug-weak=
unknown RTS option: -debug-weak=
@@ -624,6 +1029,9 @@ flag debug-weak given an argument when none was expected: --debug-weak=false
(FAIL_TEST) input: --debug-weak=true
flag debug-weak given an argument when none was expected: --debug-weak=true
+(TEST) input: -Dw
+29: debug-weak Dw SAFE
+
(FAIL_TEST) input: -Dw=
unknown RTS option: -Dw=
@@ -648,9 +1056,6 @@ unknown RTS option: -Dw=3600
(TEST) input: --debug-gccafs
30: debug-gccafs DG SAFE
-(TEST) input: -DG
-30: debug-gccafs DG SAFE
-
(FAIL_TEST) input: -debug-gccafs=
unknown RTS option: -debug-gccafs=
@@ -663,6 +1068,9 @@ flag debug-gccafs given an argument when none was expected: --debug-gccafs=false
(FAIL_TEST) input: --debug-gccafs=true
flag debug-gccafs given an argument when none was expected: --debug-gccafs=true
+(TEST) input: -DG
+30: debug-gccafs DG SAFE
+
(FAIL_TEST) input: -DG=
unknown RTS option: -DG=
@@ -687,9 +1095,6 @@ unknown RTS option: -DG=3600
(TEST) input: --debug-gc
31: debug-gc Dg SAFE
-(TEST) input: -Dg
-31: debug-gc Dg SAFE
-
(FAIL_TEST) input: -debug-gc=
unknown RTS option: -debug-gc=
@@ -702,6 +1107,9 @@ flag debug-gc given an argument when none was expected: --debug-gc=false
(FAIL_TEST) input: --debug-gc=true
flag debug-gc given an argument when none was expected: --debug-gc=true
+(TEST) input: -Dg
+31: debug-gc Dg SAFE
+
(FAIL_TEST) input: -Dg=
unknown RTS option: -Dg=
@@ -726,9 +1134,6 @@ unknown RTS option: -Dg=3600
(TEST) input: --debug-nonmoving-gc
32: debug-nonmoving-gc Dn SAFE
-(TEST) input: -Dn
-32: debug-nonmoving-gc Dn SAFE
-
(FAIL_TEST) input: -debug-nonmoving-gc=
unknown RTS option: -debug-nonmoving-gc=
@@ -741,6 +1146,9 @@ flag debug-nonmoving-gc given an argument when none was expected: --debug-nonmov
(FAIL_TEST) input: --debug-nonmoving-gc=true
flag debug-nonmoving-gc given an argument when none was expected: --debug-nonmoving-gc=true
+(TEST) input: -Dn
+32: debug-nonmoving-gc Dn SAFE
+
(FAIL_TEST) input: -Dn=
unknown RTS option: -Dn=
@@ -765,9 +1173,6 @@ unknown RTS option: -Dn=3600
(TEST) input: --debug-block-alloc
33: debug-block-alloc Db SAFE
-(TEST) input: -Db
-33: debug-block-alloc Db SAFE
-
(FAIL_TEST) input: -debug-block-alloc=
unknown RTS option: -debug-block-alloc=
@@ -780,6 +1185,9 @@ flag debug-block-alloc given an argument when none was expected: --debug-block-a
(FAIL_TEST) input: --debug-block-alloc=true
flag debug-block-alloc given an argument when none was expected: --debug-block-alloc=true
+(TEST) input: -Db
+33: debug-block-alloc Db SAFE
+
(FAIL_TEST) input: -Db=
unknown RTS option: -Db=
@@ -804,9 +1212,6 @@ unknown RTS option: -Db=3600
(TEST) input: --debug-sanity
34: debug-sanity DS SAFE
-(TEST) input: -DS
-34: debug-sanity DS SAFE
-
(FAIL_TEST) input: -debug-sanity=
unknown RTS option: -debug-sanity=
@@ -819,6 +1224,9 @@ flag debug-sanity given an argument when none was expected: --debug-sanity=false
(FAIL_TEST) input: --debug-sanity=true
flag debug-sanity given an argument when none was expected: --debug-sanity=true
+(TEST) input: -DS
+34: debug-sanity DS SAFE
+
(FAIL_TEST) input: -DS=
unknown RTS option: -DS=
@@ -843,9 +1251,6 @@ unknown RTS option: -DS=3600
(TEST) input: --debug-zero-on-gc
35: debug-zero-on-gc DZ SAFE
-(TEST) input: -DZ
-35: debug-zero-on-gc DZ SAFE
-
(FAIL_TEST) input: -debug-zero-on-gc=
unknown RTS option: -debug-zero-on-gc=
@@ -858,6 +1263,9 @@ flag debug-zero-on-gc given an argument when none was expected: --debug-zero-on-
(FAIL_TEST) input: --debug-zero-on-gc=true
flag debug-zero-on-gc given an argument when none was expected: --debug-zero-on-gc=true
+(TEST) input: -DZ
+35: debug-zero-on-gc DZ SAFE
+
(FAIL_TEST) input: -DZ=
unknown RTS option: -DZ=
@@ -882,9 +1290,6 @@ unknown RTS option: -DZ=3600
(TEST) input: --debug-stable
36: debug-stable Dt SAFE
-(TEST) input: -Dt
-36: debug-stable Dt SAFE
-
(FAIL_TEST) input: -debug-stable=
unknown RTS option: -debug-stable=
@@ -897,6 +1302,9 @@ flag debug-stable given an argument when none was expected: --debug-stable=false
(FAIL_TEST) input: --debug-stable=true
flag debug-stable given an argument when none was expected: --debug-stable=true
+(TEST) input: -Dt
+36: debug-stable Dt SAFE
+
(FAIL_TEST) input: -Dt=
unknown RTS option: -Dt=
@@ -921,9 +1329,6 @@ unknown RTS option: -Dt=3600
(TEST) input: --debug-prof
37: debug-prof Dp SAFE
-(TEST) input: -Dp
-37: debug-prof Dp SAFE
-
(FAIL_TEST) input: -debug-prof=
unknown RTS option: -debug-prof=
@@ -936,6 +1341,9 @@ flag debug-prof given an argument when none was expected: --debug-prof=false
(FAIL_TEST) input: --debug-prof=true
flag debug-prof given an argument when none was expected: --debug-prof=true
+(TEST) input: -Dp
+37: debug-prof Dp SAFE
+
(FAIL_TEST) input: -Dp=
unknown RTS option: -Dp=
@@ -960,9 +1368,6 @@ unknown RTS option: -Dp=3600
(TEST) input: --debug-linker
38: debug-linker Dl SAFE
-(TEST) input: -Dl
-38: debug-linker Dl SAFE
-
(FAIL_TEST) input: -debug-linker=
unknown RTS option: -debug-linker=
@@ -975,6 +1380,9 @@ flag debug-linker given an argument when none was expected: --debug-linker=false
(FAIL_TEST) input: --debug-linker=true
flag debug-linker given an argument when none was expected: --debug-linker=true
+(TEST) input: -Dl
+38: debug-linker Dl SAFE
+
(FAIL_TEST) input: -Dl=
unknown RTS option: -Dl=
@@ -999,9 +1407,6 @@ unknown RTS option: -Dl=3600
(TEST) input: --debug-linker-verbose
39: debug-linker-verbose DL SAFE
-(TEST) input: -DL
-39: debug-linker-verbose DL SAFE
-
(FAIL_TEST) input: -debug-linker-verbose=
unknown RTS option: -debug-linker-verbose=
@@ -1014,6 +1419,9 @@ flag debug-linker-verbose given an argument when none was expected: --debug-link
(FAIL_TEST) input: --debug-linker-verbose=true
flag debug-linker-verbose given an argument when none was expected: --debug-linker-verbose=true
+(TEST) input: -DL
+39: debug-linker-verbose DL SAFE
+
(FAIL_TEST) input: -DL=
unknown RTS option: -DL=
@@ -1038,9 +1446,6 @@ unknown RTS option: -DL=3600
(TEST) input: --debug-apply
40: debug-apply Da SAFE
-(TEST) input: -Da
-40: debug-apply Da SAFE
-
(FAIL_TEST) input: -debug-apply=
unknown RTS option: -debug-apply=
@@ -1053,6 +1458,9 @@ flag debug-apply given an argument when none was expected: --debug-apply=false
(FAIL_TEST) input: --debug-apply=true
flag debug-apply given an argument when none was expected: --debug-apply=true
+(TEST) input: -Da
+40: debug-apply Da SAFE
+
(FAIL_TEST) input: -Da=
unknown RTS option: -Da=
@@ -1077,9 +1485,6 @@ unknown RTS option: -Da=3600
(TEST) input: --debug-stm
41: debug-stm Dm SAFE
-(TEST) input: -Dm
-41: debug-stm Dm SAFE
-
(FAIL_TEST) input: -debug-stm=
unknown RTS option: -debug-stm=
@@ -1092,6 +1497,9 @@ flag debug-stm given an argument when none was expected: --debug-stm=false
(FAIL_TEST) input: --debug-stm=true
flag debug-stm given an argument when none was expected: --debug-stm=true
+(TEST) input: -Dm
+41: debug-stm Dm SAFE
+
(FAIL_TEST) input: -Dm=
unknown RTS option: -Dm=
@@ -1116,9 +1524,6 @@ unknown RTS option: -Dm=3600
(TEST) input: --debug-squeeze
42: debug-squeeze Dz SAFE
-(TEST) input: -Dz
-42: debug-squeeze Dz SAFE
-
(FAIL_TEST) input: -debug-squeeze=
unknown RTS option: -debug-squeeze=
@@ -1131,6 +1536,9 @@ flag debug-squeeze given an argument when none was expected: --debug-squeeze=fal
(FAIL_TEST) input: --debug-squeeze=true
flag debug-squeeze given an argument when none was expected: --debug-squeeze=true
+(TEST) input: -Dz
+42: debug-squeeze Dz SAFE
+
(FAIL_TEST) input: -Dz=
unknown RTS option: -Dz=
@@ -1155,9 +1563,6 @@ unknown RTS option: -Dz=3600
(TEST) input: --debug-hpc
43: debug-hpc Dc SAFE
-(TEST) input: -Dc
-43: debug-hpc Dc SAFE
-
(FAIL_TEST) input: -debug-hpc=
unknown RTS option: -debug-hpc=
@@ -1170,6 +1575,9 @@ flag debug-hpc given an argument when none was expected: --debug-hpc=false
(FAIL_TEST) input: --debug-hpc=true
flag debug-hpc given an argument when none was expected: --debug-hpc=true
+(TEST) input: -Dc
+43: debug-hpc Dc SAFE
+
(FAIL_TEST) input: -Dc=
unknown RTS option: -Dc=
@@ -1194,9 +1602,6 @@ unknown RTS option: -Dc=3600
(TEST) input: --debug-sparks
44: debug-sparks Dr SAFE
-(TEST) input: -Dr
-44: debug-sparks Dr SAFE
-
(FAIL_TEST) input: -debug-sparks=
unknown RTS option: -debug-sparks=
@@ -1209,6 +1614,9 @@ flag debug-sparks given an argument when none was expected: --debug-sparks=false
(FAIL_TEST) input: --debug-sparks=true
flag debug-sparks given an argument when none was expected: --debug-sparks=true
+(TEST) input: -Dr
+44: debug-sparks Dr SAFE
+
(FAIL_TEST) input: -Dr=
unknown RTS option: -Dr=
@@ -1233,9 +1641,6 @@ unknown RTS option: -Dr=3600
(TEST) input: --debug-compact
45: debug-compact DC SAFE
-(TEST) input: -DC
-45: debug-compact DC SAFE
-
(FAIL_TEST) input: -debug-compact=
unknown RTS option: -debug-compact=
@@ -1248,6 +1653,9 @@ flag debug-compact given an argument when none was expected: --debug-compact=fal
(FAIL_TEST) input: --debug-compact=true
flag debug-compact given an argument when none was expected: --debug-compact=true
+(TEST) input: -DC
+45: debug-compact DC SAFE
+
(FAIL_TEST) input: -DC=
unknown RTS option: -DC=
@@ -1268,3 +1676,81 @@ flag DC given an argument when none was expected: -DC3622
(FAIL_TEST) input: -DC=3600
unknown RTS option: -DC=3600
+
+(TEST) input: --max-stack-size=8193
+46: max-stack-size K UNSAFE
+expected: 8193 actual: 8193
+
+(TEST) input: --max-stack-size=8193K
+46: max-stack-size K UNSAFE
+expected: 8389632 actual: 8389632
+
+(TEST) input: --max-stack-size=2M
+46: max-stack-size K UNSAFE
+expected: 2097152 actual: 2097152
+
+(TEST) input: --max-stack-size=9G
+46: max-stack-size K UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: --max-stack-size=2G
+46: max-stack-size K UNSAFE
+expected: 2147483648 actual: 2147483648
+
+(TEST) input: --max-stack-size=3333w
+46: max-stack-size K UNSAFE
+expected: 26664 actual: 26664
+
+(FAIL_TEST) input: --max-stack-size=
+unknown RTS option: --max-stack-size=
+
+(FAIL_TEST) input: --max-stack-size=fbar
+bad value for max-stack-size=fbar
+
+(FAIL_TEST) input: --max-stack-size=false
+bad value for max-stack-size=false
+
+(FAIL_TEST) input: --max-stack-size=true
+bad value for max-stack-size=true
+
+(FAIL_TEST) input: --max-stack-sizexxzag
+unknown RTS option: --max-stack-sizexxzag
+
+(TEST) input: -K8193
+46: max-stack-size K UNSAFE
+expected: 8193 actual: 8193
+
+(TEST) input: -K8193k
+46: max-stack-size K UNSAFE
+expected: 8389632 actual: 8389632
+
+(TEST) input: -K2m
+46: max-stack-size K UNSAFE
+expected: 2097152 actual: 2097152
+
+(TEST) input: -K9g
+46: max-stack-size K UNSAFE
+expected: 9663676416 actual: 9663676416
+
+(TEST) input: -K1G
+46: max-stack-size K UNSAFE
+expected: 1073741824 actual: 1073741824
+
+(TEST) input: -K3333w
+46: max-stack-size K UNSAFE
+expected: 26664 actual: 26664
+
+(FAIL_TEST) input: -K=
+unknown RTS option: -K=
+
+(FAIL_TEST) input: -K=baz
+unknown RTS option: -K=baz
+
+(FAIL_TEST) input: -K=false
+unknown RTS option: -K=false
+
+(FAIL_TEST) input: -K=true
+unknown RTS option: -K=true
+
+(FAIL_TEST) input: -Kjhgl
+unknown RTS option: -Kjhgl
=====================================
testsuite/tests/rts/OptParse/OptParseTest.stdout
=====================================
@@ -1,7 +1,7 @@
=== OptParseTest START ===
(TEST) input: -?
-0: (null) ? SAFE
+0: help ? SAFE
(TEST) input: --install-signal-handlers
1: install-signal-handlers (null) UNSAFE
@@ -110,13 +110,17 @@
(TEST) input: --info
10: info (null) SAFE
-(TEST) input: --eventlog-flush-interval=606.909
+(TEST) input: --eventlog-flush-interval=1125
11: eventlog-flush-interval (null) SAFE
- value: 606.909000
+ value: 1125.000000
-(TEST) input: --eventlog-flush-interval=0.125
+(TEST) input: --eventlog-flush-interval=909.909
11: eventlog-flush-interval (null) SAFE
- value: 0.125000
+ value: 909.909000
+
+(TEST) input: --eventlog-flush-interval=0.00567
+11: eventlog-flush-interval (null) SAFE
+ value: 0.005670
(TEST) input: --copying-gc
12: copying-gc (null) SAFE
@@ -124,81 +128,181 @@
(TEST) input: --nonmoving-gc
13: nonmoving-gc (null) SAFE
+(TEST) input: --large-object-allocation=8193
+14: large-object-allocation AL UNSAFE
+ value: 8193
+
(TEST) input: --large-object-allocation=8193K
14: large-object-allocation AL UNSAFE
- value: 2048
+ value: 8389632
(TEST) input: --large-object-allocation=2M
14: large-object-allocation AL UNSAFE
- value: 512
+ value: 2097152
+
+(TEST) input: --large-object-allocation=9G
+14: large-object-allocation AL UNSAFE
+ value: 9663676416
+
+(TEST) input: --large-object-allocation=2G
+14: large-object-allocation AL UNSAFE
+ value: 2147483648
+
+(TEST) input: --large-object-allocation=3333w
+14: large-object-allocation AL UNSAFE
+ value: 26664
+
+(TEST) input: -AL8193
+14: large-object-allocation AL UNSAFE
+ value: 8193
+
+(TEST) input: -AL8193k
+14: large-object-allocation AL UNSAFE
+ value: 8389632
-(TEST) input: -AL9G
+(TEST) input: -AL2m
14: large-object-allocation AL UNSAFE
- value: 2359296
+ value: 2097152
-(TEST) input: -AL0.125G
+(TEST) input: -AL9g
14: large-object-allocation AL UNSAFE
- value: 32768
+ value: 9663676416
+
+(TEST) input: -AL1G
+14: large-object-allocation AL UNSAFE
+ value: 1073741824
(TEST) input: -AL3333w
14: large-object-allocation AL UNSAFE
- value: 6
+ value: 26664
+
+(TEST) input: --minimum-allocation-area-size=8193
+15: minimum-allocation-area-size A UNSAFE
+ value: 8193
(TEST) input: --minimum-allocation-area-size=8193K
15: minimum-allocation-area-size A UNSAFE
- value: 2048
+ value: 8389632
(TEST) input: --minimum-allocation-area-size=2M
15: minimum-allocation-area-size A UNSAFE
- value: 512
+ value: 2097152
+
+(TEST) input: --minimum-allocation-area-size=9G
+15: minimum-allocation-area-size A UNSAFE
+ value: 9663676416
+
+(TEST) input: --minimum-allocation-area-size=2G
+15: minimum-allocation-area-size A UNSAFE
+ value: 2147483648
+
+(TEST) input: --minimum-allocation-area-size=3333w
+15: minimum-allocation-area-size A UNSAFE
+ value: 26664
+
+(TEST) input: -A8193
+15: minimum-allocation-area-size A UNSAFE
+ value: 8193
+
+(TEST) input: -A8193k
+15: minimum-allocation-area-size A UNSAFE
+ value: 8389632
+
+(TEST) input: -A2m
+15: minimum-allocation-area-size A UNSAFE
+ value: 2097152
-(TEST) input: -A9G
+(TEST) input: -A9g
15: minimum-allocation-area-size A UNSAFE
- value: 2359296
+ value: 9663676416
-(TEST) input: -A0.125G
+(TEST) input: -A1G
15: minimum-allocation-area-size A UNSAFE
- value: 32768
+ value: 1073741824
(TEST) input: -A3333w
15: minimum-allocation-area-size A UNSAFE
- value: 6
+ value: 26664
-(TEST) input: --io-manager-threads=1
+(TEST) input: --io-manager-threads=8193
17: io-manager-threads (null) UNSAFE
- value: 1
+ value: 8193
-(TEST) input: --io-manager-threads=1234567
+(TEST) input: --io-manager-threads=8193K
17: io-manager-threads (null) UNSAFE
- value: 1234567
+ value: 8389632
-(TEST) input: --numa
+(TEST) input: --io-manager-threads=2M
+17: io-manager-threads (null) UNSAFE
+ value: 2097152
+
+(TEST) input: --io-manager-threads=9G
+17: io-manager-threads (null) UNSAFE
+ value: 9663676416
+
+(TEST) input: --io-manager-threads=2G
+17: io-manager-threads (null) UNSAFE
+ value: 2147483648
+
+(TEST) input: --io-manager-threads=3333w
+17: io-manager-threads (null) UNSAFE
+ value: 26664
+
+(TEST) input: --numa=8193
18: numa (null) SAFE
- value: 18446744073709551615
+ value: 8193
-(TEST) input: --numa=1
+(TEST) input: --numa=8193K
18: numa (null) SAFE
- value: 1
+ value: 8389632
+
+(TEST) input: --numa=2M
+18: numa (null) SAFE
+ value: 2097152
+
+(TEST) input: --numa=9G
+18: numa (null) SAFE
+ value: 9663676416
-(TEST) input: --numa=1234567
+(TEST) input: --numa=2G
18: numa (null) SAFE
- value: 1234567
+ value: 2147483648
+
+(TEST) input: --numa=3333w
+18: numa (null) SAFE
+ value: 26664
+
+(TEST) input: --numa
+18: numa (null) SAFE
+ value: 18446744073709551615
+
+(TEST) input: --debug-numa=0
+19: debug-numa (null) SAFE
+ value: 0
+
+(TEST) input: --debug-numa=16
+19: debug-numa (null) SAFE
+ value: 16
(TEST) input: --debug-numa=1
19: debug-numa (null) SAFE
value: 1
-(TEST) input: --debug-numa=8
+(TEST) input: --debug-numa=11
19: debug-numa (null) SAFE
- value: 8
+ value: 11
+
+(TEST) input: --long-gc-sync=1125
+20: long-gc-sync (null) SAFE
+ value: 1125.000000
-(TEST) input: --long-gc-sync=606.909
+(TEST) input: --long-gc-sync=909.909
20: long-gc-sync (null) SAFE
- value: 606.909000
+ value: 909.909000
-(TEST) input: --long-gc-sync=0.125
+(TEST) input: --long-gc-sync=0.00567
20: long-gc-sync (null) SAFE
- value: 0.125000
+ value: 0.005670
(TEST) input: --no-automatic-heap-samples
21: no-automatic-heap-samples (null) UNSAFE
@@ -212,49 +316,61 @@
21: no-automatic-heap-samples (null) UNSAFE
value: false
-(TEST) input: --alloc-area-chunksize=16M
+(TEST) input: --alloc-area-chunksize=8193
22: alloc-area-chunksize n UNSAFE
- value: 4096
+ value: 8193
-(TEST) input: -n16m
+(TEST) input: --alloc-area-chunksize=8193K
22: alloc-area-chunksize n UNSAFE
- value: 4096
+ value: 8389632
-(TEST) input: --alloc-area-chunksize=1234567
+(TEST) input: --alloc-area-chunksize=2M
22: alloc-area-chunksize n UNSAFE
- value: 301
+ value: 2097152
-(TEST) input: -n1239999
+(TEST) input: --alloc-area-chunksize=9G
22: alloc-area-chunksize n UNSAFE
- value: 302
+ value: 9663676416
-(TEST) input: --alloc-area-chunksize=0.225G
+(TEST) input: --alloc-area-chunksize=2G
22: alloc-area-chunksize n UNSAFE
- value: 58982
+ value: 2147483648
-(TEST) input: -n99999999k
+(TEST) input: --alloc-area-chunksize=3333w
22: alloc-area-chunksize n UNSAFE
- value: 24999999
+ value: 26664
-(TEST) input: --alloc-area-chunksize=7654W
+(TEST) input: -n8193
22: alloc-area-chunksize n UNSAFE
- value: 14
+ value: 8193
-(TEST) input: -n4567w
+(TEST) input: -n8193k
22: alloc-area-chunksize n UNSAFE
- value: 8
+ value: 8389632
-(TEST) input: -B
-16: gc-bell B UNSAFE
+(TEST) input: -n2m
+22: alloc-area-chunksize n UNSAFE
+ value: 2097152
+
+(TEST) input: -n9g
+22: alloc-area-chunksize n UNSAFE
+ value: 9663676416
+
+(TEST) input: -n1G
+22: alloc-area-chunksize n UNSAFE
+ value: 1073741824
+
+(TEST) input: -n3333w
+22: alloc-area-chunksize n UNSAFE
+ value: 26664
(TEST) input: --gc-bell
16: gc-bell B UNSAFE
-(TEST) input: --compact-gc
-23: compact-gc c UNSAFE
- value: 0.000000
+(TEST) input: -B
+16: gc-bell B UNSAFE
-(TEST) input: -c
+(TEST) input: --compact-gc
23: compact-gc c UNSAFE
value: 0.000000
@@ -262,31 +378,91 @@
23: compact-gc c UNSAFE
value: 1125.000000
+(TEST) input: --compact-gc=909.909
+23: compact-gc c UNSAFE
+ value: 909.909000
+
+(TEST) input: --compact-gc=0.00567
+23: compact-gc c UNSAFE
+ value: 0.005670
+
(TEST) input: -c
23: compact-gc c UNSAFE
value: 0.000000
+(TEST) input: -c0.125
+23: compact-gc c UNSAFE
+ value: 0.125000
+
+(TEST) input: -c707.76
+23: compact-gc c UNSAFE
+ value: 707.760000
+
(TEST) input: --use-mark-region
24: use-mark-region w UNSAFE
(TEST) input: -w
24: use-mark-region w UNSAFE
-(TEST) input: --old-gen-factor=11288
+(TEST) input: --old-gen-factor=1125
25: old-gen-factor F UNSAFE
- value: 11288.000000
+ value: 1125.000000
+
+(TEST) input: --old-gen-factor=909.909
+25: old-gen-factor F UNSAFE
+ value: 909.909000
+
+(TEST) input: --old-gen-factor=0.00567
+25: old-gen-factor F UNSAFE
+ value: 0.005670
+
+(TEST) input: -F0.125
+25: old-gen-factor F UNSAFE
+ value: 0.125000
-(TEST) input: -F188
+(TEST) input: -F707.76
25: old-gen-factor F UNSAFE
- value: 188.000000
+ value: 707.760000
-(TEST) input: --return-decay-factor=11288
+(TEST) input: --return-decay-factor=1125
26: return-decay-factor Fd UNSAFE
- value: 11288.000000
+ value: 1125.000000
+
+(TEST) input: --return-decay-factor=909.909
+26: return-decay-factor Fd UNSAFE
+ value: 909.909000
+
+(TEST) input: --return-decay-factor=0.00567
+26: return-decay-factor Fd UNSAFE
+ value: 0.005670
+
+(TEST) input: -Fd0.125
+26: return-decay-factor Fd UNSAFE
+ value: 0.125000
+
+(TEST) input: -Fd707.76
+26: return-decay-factor Fd UNSAFE
+ value: 707.760000
+
+(TEST) input: --return-decay-factor=1125
+26: return-decay-factor Fd UNSAFE
+ value: 1125.000000
+
+(TEST) input: --return-decay-factor=909.909
+26: return-decay-factor Fd UNSAFE
+ value: 909.909000
+
+(TEST) input: --return-decay-factor=0.00567
+26: return-decay-factor Fd UNSAFE
+ value: 0.005670
+
+(TEST) input: -Fd0.125
+26: return-decay-factor Fd UNSAFE
+ value: 0.125000
-(TEST) input: -Fd188
+(TEST) input: -Fd707.76
26: return-decay-factor Fd UNSAFE
- value: 188.000000
+ value: 707.760000
(TEST) input: --debug-scheduler
27: debug-scheduler Ds SAFE
@@ -402,4 +578,52 @@
(TEST) input: -DC
45: debug-compact DC SAFE
+(TEST) input: --max-stack-size=8193
+46: max-stack-size K UNSAFE
+ value: 8193
+
+(TEST) input: --max-stack-size=8193K
+46: max-stack-size K UNSAFE
+ value: 8389632
+
+(TEST) input: --max-stack-size=2M
+46: max-stack-size K UNSAFE
+ value: 2097152
+
+(TEST) input: --max-stack-size=9G
+46: max-stack-size K UNSAFE
+ value: 9663676416
+
+(TEST) input: --max-stack-size=2G
+46: max-stack-size K UNSAFE
+ value: 2147483648
+
+(TEST) input: --max-stack-size=3333w
+46: max-stack-size K UNSAFE
+ value: 26664
+
+(TEST) input: -K8193
+46: max-stack-size K UNSAFE
+ value: 8193
+
+(TEST) input: -K8193k
+46: max-stack-size K UNSAFE
+ value: 8389632
+
+(TEST) input: -K2m
+46: max-stack-size K UNSAFE
+ value: 2097152
+
+(TEST) input: -K9g
+46: max-stack-size K UNSAFE
+ value: 9663676416
+
+(TEST) input: -K1G
+46: max-stack-size K UNSAFE
+ value: 1073741824
+
+(TEST) input: -K3333w
+46: max-stack-size K UNSAFE
+ value: 26664
+
=== OptParseTest END ===
=====================================
testsuite/tests/rts/OptParse/OptParseTestUtil.c
=====================================
@@ -1,37 +1,23 @@
#include <stdio.h>
+#include <string.h>
#include "Rts.h"
#include "OptParseTestUtil.h"
-char CMP_BUF[100];
extern bool ERROR;
-
-#define FAIL_TEST(...) \
- do { \
- snprintf(CMP_BUF, sizeof(CMP_BUF), __VA_ARGS__); \
- _FAIL_TEST(CMP_BUF); \
- } while (false)
+char CMP_BUF[CMP_BUF_LEN];
void _TEST( char* flagToTest
, int expectedFlagKey
- , char* expectedLongName
- , char* expectedShortName
- , RtsFlagValueType expectedFlagValueType
- , bool safe
- , RtsFlagValue expectedValue
- ) {
+ , RtsFlagValue expectedValue)
+{
debugBelch("\n(TEST) input: %s\n", flagToTest);
printf("\n(TEST) input: %s\n", flagToTest);
RtsFlagValue flagValue = parseArg(flagToTest, &ERROR);
CHECK(!ERROR);
RtsFlagName flag = rtsFlags[flagValue.key];
-
- printf("%i: %s %s %s\n", flagValue.key , flag.longName, flag.shortName, safe ? "SAFE": "UNSAFE");
- debugBelch("%i: %s %s %s\n", flagValue.key , flag.longName, flag.shortName, safe ? "SAFE": "UNSAFE");
+ printf("%i: %s %s %s\n", flagValue.key , flag.longName, flag.shortName, flag.optionSafe ? "SAFE": "UNSAFE");
+ debugBelch("%i: %s %s %s\n", flagValue.key , flag.longName, flag.shortName, flag.optionSafe ? "SAFE": "UNSAFE");
CHECK(flagValue.key == expectedFlagKey);
- CHECK(flag.longName == expectedLongName);
- CHECK(flag.shortName == expectedShortName);
- CHECK(flag.valueType == expectedFlagValueType);
- CHECK(flag.optionSafe == safe);
RtsFlagValueType valueTy = flag.valueType;
if (valueTy == BOOL) {
printf("\tvalue: %s\n", flagValue.as.boolean ? "true" : "false");
@@ -61,52 +47,158 @@ void _FAIL_TEST(char* flagToTest)
ERROR = false;
}
-void _VOID_FLAG_TEST(const RtsFlagKey i)
+void VOID_FLAG_TEST(const RtsFlagKey i)
{
RtsFlagName name = rtsFlags[i];
- char buffer[100];
- snprintf(buffer, sizeof(buffer), "--%s", name.longName);
- _TEST( buffer, i, name.longName, name.shortName
- , name.valueType, name.optionSafe, NO_VAL(i));
- snprintf(buffer, sizeof(buffer), "-%s", name.shortName);
- _TEST( buffer, i, name.longName, name.shortName
- , name.valueType, name.optionSafe, NO_VAL(i));
- FAIL_TEST("-%s=", name.longName);
- FAIL_TEST("--%s=123G", name.longName);
- FAIL_TEST("--%s=false", name.longName);
- FAIL_TEST("--%s=true", name.longName);
- FAIL_TEST("-%s=", name.shortName);
- FAIL_TEST("-%s3621", name.shortName);
- FAIL_TEST("-%s=3622", name.shortName);
- FAIL_TEST("-%s=true", name.shortName);
- FAIL_TEST("-%s=", name.shortName);
- FAIL_TEST("-%s3622", name.shortName);
- FAIL_TEST("-%s=3600", name.shortName);
+ if (name.longName)
+ {
+ VOID_TEST(i, "--%s", name.longName);
+
+ FAIL_TEST("-%s=", name.longName);
+ FAIL_TEST("--%s=123G", name.longName);
+ FAIL_TEST("--%s=false", name.longName);
+ FAIL_TEST("--%s=true", name.longName);
+ }
+ if (name.shortName)
+ {
+ VOID_TEST(i, "-%s", name.shortName);
+
+ FAIL_TEST("-%s=", name.shortName);
+ FAIL_TEST("-%s3621", name.shortName);
+ FAIL_TEST("-%s=3622", name.shortName);
+ FAIL_TEST("-%s=true", name.shortName);
+ FAIL_TEST("-%s=", name.shortName);
+ FAIL_TEST("-%s3622", name.shortName);
+ FAIL_TEST("-%s=3600", name.shortName);
+ }
}
-void _BOOL_FLAG_TEST(const RtsFlagKey i)
+void BOOL_FLAG_TEST(const RtsFlagKey i)
{
RtsFlagName name = rtsFlags[i];
- char buffer[100];
- if (name.longName != NULL) {
- snprintf(buffer, sizeof(buffer), "--%s", name.longName);
- _TEST( buffer, i
- , name.longName, name.shortName
- , BOOL, name.optionSafe, BOOL_VAL(i, true));
- snprintf(buffer, sizeof(buffer), "--%s=yes", name.longName);
- _TEST( buffer, i
- , name.longName, name.shortName
- , BOOL, name.optionSafe, BOOL_VAL(i, true));
- snprintf(buffer, sizeof(buffer), "--%s=no", name.longName);
- _TEST( buffer, i
- , name.longName, name.shortName
- , BOOL, name.optionSafe, BOOL_VAL(i, false));
+ if (name.longName != NULL)
+ {
+ BOOL_TEST(i, true, "--%s", name.longName);
+ BOOL_TEST(i, true, "--%s=yes", name.longName);
+ BOOL_TEST(i, false, "--%s=no", name.longName);
+
FAIL_TEST("--%s=", name.longName);
FAIL_TEST("--%s=foo", name.longName);
FAIL_TEST("--%s=1", name.longName);
FAIL_TEST("--%sjhgl", name.longName);
}
- if (name.shortName != NULL) {
- FAIL_TEST("-%s", name.shortName);
+ if (name.shortName != NULL)
+ {
+ BOOL_TEST(i, true, "-%s", name.shortName);
+
+ FAIL_TEST("-%s=", name.shortName);
+ FAIL_TEST("-%s=foo", name.shortName);
+ FAIL_TEST("-%s=1", name.shortName);
+ FAIL_TEST("-%sjhgl", name.shortName);
+ }
+}
+
+void DOUBLE_FLAG_TEST(const RtsFlagKey i)
+{
+ RtsFlagName name = rtsFlags[i];
+ if (name.longName != NULL)
+ {
+ if (!name.valueRequired)
+ {
+ VOID_TEST(i, "--%s", name.longName);
+ }
+ DOUBLE_TEST(i, 1125.0, "--%s=1125", name.longName);
+ DOUBLE_TEST(i, 909.909, "--%s=909.909", name.longName);
+ DOUBLE_TEST(i, 0.00567, "--%s=0.00567", name.longName);
+
+ FAIL_TEST("--%s=", name.longName);
+ FAIL_TEST("--%s=bar", name.longName);
+ FAIL_TEST("--%s=false", name.longName);
+ FAIL_TEST("--%s=true", name.longName);
+ FAIL_TEST("--%sxxzag", name.longName);
+ }
+ if (name.shortName != NULL)
+ {
+ if (!name.valueRequired)
+ {
+ VOID_TEST(i, "-%s", name.shortName);
+ }
+ DOUBLE_TEST(i, 0.125, "-%s0.125", name.shortName);
+ DOUBLE_TEST(i, 707.76, "-%s707.76", name.shortName);
+
+ FAIL_TEST("-%s=", name.shortName);
+ FAIL_TEST("-%s=foo", name.shortName);
+ FAIL_TEST("-%s=false", name.shortName);
+ FAIL_TEST("-%s=true", name.shortName);
+ }
+}
+
+void STGWORD64_FLAG_TEST(const RtsFlagKey i)
+{
+ RtsFlagName name = rtsFlags[i];
+ if (name.longName != NULL)
+ {
+ STGWORD64_TEST(i, 8193.0 , "--%s=8193", name.longName);
+ STGWORD64_TEST(i, 8389632.0, "--%s=8193K", name.longName);
+ STGWORD64_TEST(i, 2097152.0, "--%s=2M", name.longName);
+ STGWORD64_TEST(i, 9663676416.0, "--%s=9G", name.longName);
+ STGWORD64_TEST(i, 2147483648.0, "--%s=2G", name.longName);
+ STGWORD64_TEST(i, 26664.0, "--%s=3333w", name.longName);
+
+ FAIL_TEST("--%s=", name.longName);
+ FAIL_TEST("--%s=fbar", name.longName);
+ FAIL_TEST("--%s=false", name.longName);
+ FAIL_TEST("--%s=true", name.longName);
+ FAIL_TEST("--%sxxzag", name.longName);
+ }
+ if (name.shortName != NULL)
+ {
+ STGWORD64_TEST(i, 8193.0, "-%s8193", name.shortName);
+ STGWORD64_TEST(i, 8389632.0, "-%s8193k", name.shortName);
+ STGWORD64_TEST(i, 2097152.0, "-%s2m", name.shortName);
+ STGWORD64_TEST(i, 9663676416.0, "-%s9g", name.shortName);
+ STGWORD64_TEST(i, 1073741824.0, "-%s1G", name.shortName);
+ STGWORD64_TEST(i, 26664.0, "-%s3333w", name.shortName);
+
+ FAIL_TEST("-%s=", name.shortName);
+ FAIL_TEST("-%s=baz", name.shortName);
+ FAIL_TEST("-%s=false", name.shortName);
+ FAIL_TEST("-%s=true", name.shortName);
+ FAIL_TEST("-%sjhgl", name.shortName);
+ }
+}
+
+void NATURAL_NUM_FLAG_TEST(const RtsFlagKey i, int min, int max)
+{
+ RtsFlagName name = rtsFlags[i];
+ if (name.longName != NULL)
+ {
+ STGWORD64_TEST(i, (double)min, "--%s=%i", name.longName, min);
+ STGWORD64_TEST(i, (double)max, "--%s=%i", name.longName, max);
+ STGWORD64_TEST(i, (double)min+1, "--%s=%i", name.longName, min+1);
+ STGWORD64_TEST(i, (double)max-5, "--%s=%i", name.longName, max-5);
+
+ FAIL_TEST("--%s=%i", name.longName, min-1);
+ FAIL_TEST("--%s=%i", name.longName, max+1);
+ FAIL_TEST("--%s=", name.longName);
+ FAIL_TEST("--%s=fbar", name.longName);
+ FAIL_TEST("--%s=false", name.longName);
+ FAIL_TEST("--%s=true", name.longName);
+ FAIL_TEST("--%sxxzag", name.longName);
+ }
+ if (name.shortName != NULL)
+ {
+ STGWORD64_TEST(i, (double)min, "--%s=%i", name.shortName, min);
+ STGWORD64_TEST(i, (double)max, "--%s=%i", name.shortName, max);
+ STGWORD64_TEST(i, (double)min+2, "--%s=%i", name.shortName, min+2);
+ STGWORD64_TEST(i, (double)max-3, "--%s=%i", name.shortName, max-3);
+
+ FAIL_TEST("--%s=%i", name.shortName, min-1);
+ FAIL_TEST("--%s=%i", name.shortName, max+1);
+ FAIL_TEST("--%s=", name.shortName);
+ FAIL_TEST("--%s=fbar", name.shortName);
+ FAIL_TEST("--%s=false", name.shortName);
+ FAIL_TEST("--%s=true", name.shortName);
+ FAIL_TEST("--%sxxzag", name.shortName);
}
}
=====================================
testsuite/tests/rts/OptParse/OptParseTestUtil.h
=====================================
@@ -1,14 +1,45 @@
#include "Rts.h"
-void _TEST( char* flagToTest
- , int expectedFlagKey
- , char* expectedLongName
- , char* expectedShortName
- , RtsFlagValueType expectedFlagValueType
- , bool safe
+#define CMP_BUF_LEN 100
+extern char CMP_BUF[CMP_BUF_LEN];
+
+void _TEST( char* flagToTest, int expectedFlagKey
, RtsFlagValue expectedValue
);
-
void _FAIL_TEST(char* flagToTest);
-void _VOID_FLAG_TEST(const RtsFlagKey i);
-void _BOOL_FLAG_TEST(const RtsFlagKey i);
+
+#define FAIL_TEST(...) \
+ do { \
+ snprintf(CMP_BUF, sizeof(CMP_BUF), __VA_ARGS__); \
+ _FAIL_TEST(CMP_BUF); \
+ } while (false)
+
+#define VOID_TEST(i, ...) \
+ do { \
+ snprintf(CMP_BUF, CMP_BUF_LEN, __VA_ARGS__); \
+ _TEST(CMP_BUF, i, NO_VAL(i)); \
+ } while (false)
+
+#define BOOL_TEST(i, value, ...) \
+ do { \
+ snprintf(CMP_BUF, CMP_BUF_LEN, __VA_ARGS__); \
+ _TEST(CMP_BUF, i, BOOL_VAL(i, value)); \
+ } while (false)
+
+#define DOUBLE_TEST(i, value, ...) \
+ do { \
+ snprintf(CMP_BUF, CMP_BUF_LEN, __VA_ARGS__); \
+ _TEST(CMP_BUF, i, DOUBLE_VAL(i, value)); \
+ } while (false)
+
+#define STGWORD64_TEST(i, value, ...) \
+ do { \
+ snprintf(CMP_BUF, CMP_BUF_LEN, __VA_ARGS__); \
+ _TEST(CMP_BUF, i, STGWORD64_VAL(i, value)); \
+ } while (false)
+
+void VOID_FLAG_TEST(const RtsFlagKey i);
+void BOOL_FLAG_TEST(const RtsFlagKey i);
+void DOUBLE_FLAG_TEST(const RtsFlagKey i);
+void STGWORD64_FLAG_TEST(const RtsFlagKey i);
+void NATURAL_NUM_FLAG_TEST(const RtsFlagKey i, int min, int max);
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0fe88e36e435f22371cff1b925d2eb185b1d0d39...c9197a34cedb628895179e1340cda592a0cae8e8
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0fe88e36e435f22371cff1b925d2eb185b1d0d39...c9197a34cedb628895179e1340cda592a0cae8e8
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221218/4feb908c/attachment-0001.html>
More information about the ghc-commits
mailing list