comps / ptef

Portable Test Execution Framework
MIT License
5 stars 0 forks source link

Provide tef-report-server #1

Closed comps closed 2 years ago

comps commented 3 years ago

(After the runner is re-written to C.)

For bash and languages that can't access the shared object library ABI directly, provide a tef-report-server which would take some argument (-f or --fd) as file descriptor number and then receive RESULT /path/to/executable through it. It would then call the normal "tef results" logic (shared library) to display it in color on fd 0, write it to TEF_RESULTS_FD, do all that via POSIX locks (block --fd writer until the result is written + unlocked), etc., etc.

The reason is that spawning a new process (tef-report) is very slow, but we can start a persistent server and write results to it natively via a pipe, all using bash builtins. This probably wouldn't persist across suite levels (different runners), but would still be useful if one script reports thousands of results (ie. from annocheck, oscap, LTP, etc.).

An alternate approach is to re-write the whole logic in pure bash (as it is now), but that lacks ie. the POSIX locking functionality, which cannot be done using bash builtins only. And possibly other future features.

comps commented 3 years ago

Alternatively, just google some more, because bash has "loadable builtins":

It should be possible to provide at least tef-report is a builtin via enable -f <filename>.

comps commented 2 years ago

Given that the current implementation uses bash builtins and any test suite can implement a "report server" easily using either C or Python APIs of ptef, this issue is probably not something worth doing.