http://www.perlmonks.org?node_id=1141452


in reply to Re^2: C test suite management with perl
in thread C test suite management with perl

From the link you provided:

C TAP Harness can run Perl test scripts directly and interpret the results correctly, and similarly the Perl Test::Harness module and prove command can run TAP tests written in other languages using, for example, the TAP library that comes with C TAP Harness. You can, if you wish, use the library that comes with C TAP Harness but use prove instead of runtests for running the test suite.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
  • Comment on Re^3: C test suite management with perl

Replies are listed 'Best First'.
Re^4: C test suite management with perl
by QuillMeantTen (Friar) on Sep 09, 2015 at 18:34 UTC

    it seems that to make a correct use of that library and the power of prove I am going to need more than the cursory knowledge I have of the autotools.
    I shall start reading some books I had put away for such a time right away

    Great and many thanks for your wise counsel and hints fellow monk you have set me on a path of better learning and understanding.

Re^4: C test suite management with perl
by QuillMeantTen (Friar) on Sep 10, 2015 at 10:36 UTC

    Update: after fiddling around I found out that any makefile in the tests subdirectory is ignored, so I probably am missing something when writing my main Makefile.am. After a bit of fiddling around I still have the error output, yet when I run make check-local I get undefined references error
    This is not surprising since the gcc command run does not include either the tap files or the main program's c files


    YAU(yet another update) I managed to make it work but I did not follow the c tap harness author instructions : I added a line to my Makefile.am so it builds the test executable before running the test suite, that way everything works fine. Still it feels a bit unelegant and like cheating, am I doing things right?

    So after some studying I think I'm starting to get autotools to do what I want (at least autoconf et automake) right now I'm confronted with a bit of a conundrum :

    For any test programs that need to be compiled, add build rules for them in Makefile.am, simliar to:
    tests_libtap_c_basic_LDADD = tests/tap/libtap.a

    this line is quite a mysterious : as I understand it, if I have in my tests directory a subfolder containing tests for a specific c file (lets call that test file specific_tests.c) to have the harness run those tests I'd need to add to Makefile.am the following line :

    specific_tests_LDADD=tests/tab/libtap.

    Thing is if I add this line and then autoreconf I got the following output :

    Makefile.am:10: warning: variable 'specific_tests_LDADD' is defined bu +t no program or Makefile.am:10: library has 'specific_tests' as canonical name (possib +le typo)

    I must add that if I compile specific_tests myself into a specific_tests.t output file make checklocal runs perfectly "