Updating dummy test suite.
This commit is contained in:
parent
04b2c7e316
commit
6c319b5d2b
2 changed files with 24 additions and 4 deletions
|
@ -1066,7 +1066,7 @@ PrintUsage() {
|
||||||
printf(" [--logfile BASENAME] [--logdir DIR] [--log-stdout] [--xml]\n");
|
printf(" [--logfile BASENAME] [--logdir DIR] [--log-stdout] [--xml]\n");
|
||||||
printf(" [--xsl [STYLESHEET]] [--seed VALUE] [--iterations VALUE]\n");
|
printf(" [--xsl [STYLESHEET]] [--seed VALUE] [--iterations VALUE]\n");
|
||||||
printf(" [--exec-key KEY] [--timeout VALUE] [--test TEST]\n");
|
printf(" [--exec-key KEY] [--timeout VALUE] [--test TEST]\n");
|
||||||
printf(" [--name-contains SUBSTR] [--suite SUITE]\n");
|
printf(" [--name-contains SUBSTR] [--suite SUITE] [--include-dummy]\n");
|
||||||
printf(" [--version] [--help]\n");
|
printf(" [--version] [--help]\n");
|
||||||
printf("Options:\n");
|
printf("Options:\n");
|
||||||
printf(" --in-proc Executes tests in-process\n");
|
printf(" --in-proc Executes tests in-process\n");
|
||||||
|
|
|
@ -41,11 +41,14 @@ static const TestCaseReference test2 =
|
||||||
(TestCaseReference){ "dummycase2", "description", TEST_ENABLED, 0, 0};
|
(TestCaseReference){ "dummycase2", "description", TEST_ENABLED, 0, 0};
|
||||||
|
|
||||||
static const TestCaseReference test3 =
|
static const TestCaseReference test3 =
|
||||||
(TestCaseReference){ "dummycase3", "description", TEST_ENABLED, 0, 2};
|
(TestCaseReference){ "testfuzzy_case3", "description", TEST_ENABLED, 0, 2};
|
||||||
|
|
||||||
|
static const TestCaseReference test4 =
|
||||||
|
(TestCaseReference){ "testfuzzy_case4", "description", TEST_ENABLED, 0, 2};
|
||||||
|
|
||||||
/* Test suite */
|
/* Test suite */
|
||||||
extern const TestCaseReference *testSuite[] = {
|
extern const TestCaseReference *testSuite[] = {
|
||||||
&test1, &test2, &test3, NULL
|
&test1, &test2, &test3, &test4, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,8 +142,25 @@ dummycase2(void *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dummycase3(void *arg)
|
testfuzzy_case3(void *arg)
|
||||||
{
|
{
|
||||||
|
// Simulates a fuzzing failure
|
||||||
AssertTrue(RandomUint8() != 100, "Value is 100");
|
AssertTrue(RandomUint8() != 100, "Value is 100");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
f(void) {
|
||||||
|
int* x = malloc(10 * sizeof(int));
|
||||||
|
x[10] = 0; // problem 1: heap block overrun
|
||||||
|
} // problem 2: memory leak -- x not freed
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
testfuzzy_case4(void *arg)
|
||||||
|
{
|
||||||
|
// Creates a memory leak
|
||||||
|
f();
|
||||||
|
|
||||||
|
AssertPass("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue