Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify automake include file for unittests #52

Open
andreas-bok-sociomantic opened this issue Aug 30, 2016 · 10 comments
Open

Simplify automake include file for unittests #52

andreas-bok-sociomantic opened this issue Aug 30, 2016 · 10 comments
Milestone

Comments

@andreas-bok-sociomantic
Copy link
Contributor

andreas-bok-sociomantic commented Aug 30, 2016

Adding a unittest currently requires manually adding several lines to the include.am. See below
A less redundant way of defining unittest make targets should be devised.

tests_unit_connect_SOURCES= tests/unit/connect.c
tests_unit_connect_LDADD= libdrizzle/libdrizzle-redux.la
nodist_EXTRA_tests_unit_connect_SOURCES = dummy.cxx
check_PROGRAMS+= tests/unit/connect
noinst_PROGRAMS+= tests/unit/connect

gdb-connect: tests/unit/connect
        @$(GDB_COMMAND) tests/unit/connect

valgrind-connect: tests/unit/connect
        @$(VALGRIND_COMMAND) tests/unit/connect

check-connect: tests/unit/connect
        tests/unit/connect
@andreas-bok-sociomantic
Copy link
Contributor Author

@leandro-lucarella-sociomantic
Copy link
Contributor

I don't understand what you have to do to add a new unit test, so connect.c is your new test file and all the rest is boilerplate?

@andreas-bok-sociomantic
Copy link
Contributor Author

so connect.c is your new test file and all the rest is boilerplate?

Yes

@andreas-bok-sociomantic
Copy link
Contributor Author

andreas-bok-sociomantic commented Aug 31, 2016

is the answer makd :) Makeit of course

@leandro-lucarella-sociomantic
Copy link
Contributor

leandro-lucarella-sociomantic commented Aug 31, 2016

I think it might be less work to use something like:

define add_unit_test
tests_unit_$1_SOURCES= tests/unit/$1.c
tests_unit_$1_LDADD= libdrizzle/libdrizzle-redux.la
nodist_EXTRA_tests_unit_$1_SOURCES = dummy.cxx
check_PROGRAMS+= tests/unit/$1
noinst_PROGRAMS+= tests/unit/$1

gdb-$1: tests/unit/$1
        @$(GDB_COMMAND) tests/unit/$1

valgrind-$1: tests/unit/$1
        @$(VALGRIND_COMMAND) tests/unit/$1

check-$1: tests/unit/$1
        tests/unit/$1
endef

$(call exec,add_unit_test,connect)
$(call exec,add_unit_test,another_test)
# etc.

Untested, and I'm not sure if you can use macros so lightly inside automake, but it might be worth trying...

@leandro-lucarella-sociomantic
Copy link
Contributor

Or maybe you have to use it with $(eval), I don't remember exactly. Maybe you need to do something similar to https://github.com/sociomantic-tsunami/makd/blob/4d617b1624ab0d1a890e5d91957903b92abe9f65/Makd.mak#L317-L323.

@andreas-bok-sociomantic
Copy link
Contributor Author

TX luca, I will try out your suggestions

@andreas-bok-sociomantic andreas-bok-sociomantic added this to the 5.3.x milestone Sep 13, 2016
@andreas-bok-sociomantic andreas-bok-sociomantic modified the milestones: 5.3.x, v5.4.x Dec 19, 2016
@andreas-bok-sociomantic
Copy link
Contributor Author

Somewhat related to #95

@ben-palmer-sociomantic
Copy link
Collaborator

Should this be closed now? Its listed as part of v5.4.x.

@andreas-bok-sociomantic
Copy link
Contributor Author

I would rather move it to future work. The addition of unittests is still a bit messy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants