VIR_LOG_INIT("tests.testutils");
+#include "virbitmap.h"
#include "virfile.h"
static unsigned int testDebug = -1;
static bool testOOMActive;
static size_t testCounter;
-static size_t testStart;
-static size_t testEnd;
+static virBitmapPtr testBitmap;
char *progname;
/* Skip tests if out of range */
- if ((testStart != 0) &&
- (testCounter < testStart ||
- testCounter > testEnd))
+ if (testBitmap && !virBitmapIsBitSet(testBitmap, testCounter))
return 0;
if (virTestGetVerbose())
}
if ((testRange = getenv("VIR_TEST_RANGE")) != NULL) {
- char *end = NULL;
- unsigned int iv;
- if (virStrToLong_ui(testRange, &end, 10, &iv) < 0) {
+ if (virBitmapParseUnlimited(testRange, &testBitmap) < 0) {
fprintf(stderr, "Cannot parse range %s\n", testRange);
return EXIT_FAILURE;
}
- testStart = testEnd = iv;
- if (end && *end) {
- if (*end != '-') {
- fprintf(stderr, "Cannot parse range %s\n", testRange);
- return EXIT_FAILURE;
- }
- end++;
- if (virStrToLong_ui(end, NULL, 10, &iv) < 0) {
- fprintf(stderr, "Cannot parse range %s\n", testRange);
- return EXIT_FAILURE;
- }
- testEnd = iv;
-
- if (testEnd < testStart) {
- fprintf(stderr, "Test range end %zu must be >= %zu\n", testEnd, testStart);
- return EXIT_FAILURE;
- }
- }
}
#ifdef TEST_OOM