|
nsz |
d14d36 |
simple libc tests based on the libc-testsuit
|
|
nsz |
d14d36 |
and libc-bench of dalias
|
|
nsz |
7308b3 |
see http://git.etalabs.net/cgi-bin/gitweb.cgi
|
|
nsz |
7d87d3 |
see http://www.etalabs.net/libc-bench.html
|
|
nsz |
7308b3 |
|
|
nsz |
7308b3 |
build tests:
|
|
nsz |
7308b3 |
cp Makefile.conf.def Makefile.conf
|
|
nsz |
7308b3 |
# edit Makefile.conf
|
|
nsz |
7308b3 |
make
|
|
nsz |
7308b3 |
run tests:
|
|
nsz |
7308b3 |
./t
|
|
nsz |
d14d36 |
run benchmarks:
|
|
nsz |
d14d36 |
./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 |
7d87d3 |
in the root directory make builds an executable with all tests
|
|
nsz |
7d87d3 |
in a src/* directory make builds only local tests
|
|
nsz |
7308b3 |
see Makefile.inc
|
|
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 |
see Makefile.inc
|
|
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 |
7d87d3 |
N until the runing time is long enough, then time/N is printed
|
|
nsz |
7d87d3 |
|
|
nsz |
7d87d3 |
edit the generated tests.h to exclude certain tests
|
|
nsz |
d14d36 |
see common/t.c for tests
|
|
nsz |
d14d36 |
see common/b.c for benchmarks
|