testing/scanftest: add number of correct/incorrect tests
Verbose output for CI testing with OK and FAILED number of tests. File name is also now configurable with TESTING_SCANFTEST_FNAME. Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
parent
8398297518
commit
cd1d855a71
@ -30,4 +30,10 @@ config TESTING_SCANFTEST_STACKSIZE
|
||||
int "Scanftest stack size"
|
||||
default DEFAULT_TASK_STACKSIZE
|
||||
|
||||
config TESTING_SCANFTEST_FNAME
|
||||
string "Scanftest file name"
|
||||
default "/mnt/fs/test.txt"
|
||||
---help---
|
||||
Path to the file for test writes/reads.
|
||||
|
||||
endif
|
||||
|
@ -1083,8 +1083,11 @@ int main(int argc, FAR char *argv[])
|
||||
double d2;
|
||||
FAR FILE *fp;
|
||||
|
||||
int tests_ok = 0;
|
||||
int tests_err = 0;
|
||||
|
||||
FAR const char *teststring = "teststring a";
|
||||
FAR const char *fname = "/mnt/fs/test.txt";
|
||||
FAR const char *fname = CONFIG_TESTING_SCANFTEST_FNAME;
|
||||
|
||||
/* Test that scanf() can recognize percent-signs in the input. ** Test that
|
||||
* integer converters skip white-space. ** Test that "%i" can scan a single
|
||||
@ -1129,20 +1132,24 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
if (strcmp(s1, teststring) != 0)
|
||||
{
|
||||
tests_err += 1;
|
||||
printf("Error %s != %s.\n", teststring, s1);
|
||||
}
|
||||
else
|
||||
{
|
||||
tests_ok += 1;
|
||||
printf("Test PASSED.\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tests_err += 1;
|
||||
printf("Error opening %s for read.\n", fname);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tests_err += 1;
|
||||
printf("Error opening %s for write.\n", fname);
|
||||
}
|
||||
}
|
||||
@ -1171,6 +1178,7 @@ int main(int argc, FAR char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
tests_err += 1;
|
||||
printf("Error opening %s for write.\n", fname);
|
||||
break;
|
||||
}
|
||||
@ -1320,8 +1328,13 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
if (ok)
|
||||
{
|
||||
tests_ok += 1;
|
||||
printf("Test #%u PASSED.\n", t + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
tests_err += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1457,9 +1470,16 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
if (ok)
|
||||
{
|
||||
tests_ok += 1;
|
||||
printf("Test #%u PASSED.\n", t + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
tests_err += 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Scanf tests done... OK: %d, FAILED: %d\n", tests_ok, tests_err);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user