2015-07-10 10:07:36 -04:00
|
|
|
FreeSWITCH unit tests should be kept as shallow unit tests and micro
|
|
|
|
benchmarks testing functionality exposed through libfreeswitch.
|
|
|
|
|
|
|
|
Requirements for a new unit tests:
|
|
|
|
|
|
|
|
1. Tests must use TAP(Test Anything Protocol) output format, and must
|
|
|
|
print to stderr the summary statistics of the test before exiting.
|
|
|
|
|
|
|
|
2. Each test must return 0 on successful completion, or a non-zero
|
|
|
|
result in case of a failure.
|
|
|
|
|
|
|
|
3. Benchmarking stats should be output as a TAP note at the end of the
|
|
|
|
test in a human and machine(regex) parsable format
|
|
|
|
|
|
|
|
Use libtap from https://github.com/zorgnax/libtap
|
|
|
|
cd /usr/local/src/
|
|
|
|
git clone https://github.com/zorgnax/libtap.git
|
2015-07-10 17:37:05 -04:00
|
|
|
make PREFIX=/usr install
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
To run a benchmark version of a unit test, update the loops count, and
|
|
|
|
make sure to uncomment the 'BENCHMARK' define line. Then you can run
|
|
|
|
the benchmark with:
|
|
|
|
|
|
|
|
perf record ./.libs/switch_hash
|
|
|
|
|
|
|
|
Once that is completed you can view the results with:
|
|
|
|
|
|
|
|
perf report
|
|
|
|
|