|
nsz |
fe6029 |
simple libc tests
|
|
nsz |
fe6029 |
based on the libc-testsuit and libc-bench of dalias
|
|
nsz |
7308b3 |
see http://git.etalabs.net/cgi-bin/gitweb.cgi
|
|
nsz |
7308b3 |
|
|
nsz |
7308b3 |
build tests:
|
|
nsz |
b36267 |
cp dist/config.mak .
|
|
nsz |
b36267 |
# edit config.mak
|
|
nsz |
7308b3 |
make
|
|
nsz |
7308b3 |
run tests:
|
|
nsz |
b36267 |
make
|
|
nsz |
d14d36 |
run benchmarks:
|
|
nsz |
b36267 |
make b
|
|
nsz |
7308b3 |
|
|
nsz |
7d87d3 |
framework:
|
|
nsz |
7308b3 |
|
|
nsz |
7308b3 |
the only hook in the test framework is error(...) which
|
|
nsz |
7308b3 |
prints a formatted message and sets the test to failed
|
|
nsz |
7308b3 |
see common/test.h
|
|
nsz |
7308b3 |
|
|
nsz |
7308b3 |
a test function looks like
|
|
nsz |
7308b3 |
void test_foo() {
|
|
nsz |
7308b3 |
if (foo != 42)
|
|
nsz |
7308b3 |
error("foo=%d expected 42\n", foo);
|
|
nsz |
7308b3 |
}
|
|
nsz |
7308b3 |
extern functions with name ~ /^test/ are recognized to be
|
|
nsz |
7308b3 |
test functions
|
|
nsz |
7308b3 |
|
|
nsz |
7d87d3 |
a benchmark function looks like
|
|
nsz |
7d87d3 |
void bench_foo(int N) {
|
|
nsz |
7d87d3 |
for (i = 0; i < N; i++)
|
|
nsz |
7d87d3 |
foo();
|
|
nsz |
7d87d3 |
}
|
|
nsz |
7d87d3 |
benchmark functions are repeatedly called with an increasing
|
|
nsz |
b36267 |
N until the running time is long enough, then time/N is printed
|
|
nsz |
7d87d3 |
|
|
nsz |
b36267 |
see Makefile.inc for build system details
|
|
nsz |
b36267 |
see common/t.c for test details
|
|
nsz |
b36267 |
see common/b.c for benchmark details
|