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

testing for libgap saving/loading workspaces #2833

Merged
merged 4 commits into from
Nov 1, 2018

Conversation

dimpase
Copy link
Member

@dimpase dimpase commented Sep 19, 2018

Currently loading does not work due to GAP issue #2832

@dimpase dimpase added the do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) label Sep 19, 2018
@codecov
Copy link

codecov bot commented Sep 19, 2018

Codecov Report

Merging #2833 into master will increase coverage by <.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2833      +/-   ##
==========================================
+ Coverage   83.79%   83.79%   +<.01%     
==========================================
  Files         682      682              
  Lines      346236   346236              
==========================================
+ Hits       290135   290143       +8     
+ Misses      56101    56093       -8
Impacted Files Coverage Δ
hpcgap/lib/hpc/stdtasks.g 72.39% <0%> (+0.4%) ⬆️
src/saveload.c 68.96% <0%> (+0.53%) ⬆️
src/vector.c 95.2% <0%> (+1.27%) ⬆️

@dimpase dimpase added gapdays2018-fall Issues and PRs that arose at https://www.gapdays.de/gapdays2018-fall and removed do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) labels Sep 19, 2018
@dimpase
Copy link
Member Author

dimpase commented Sep 19, 2018

With #2840 the workspace loading test works - I'll polish it a bit more.

@dimpase
Copy link
Member Author

dimpase commented Sep 20, 2018

OK, so now it's ready for reviewing. I've also split the only previously present in tst/testlibgap
test, basic.c, by @markuspf , into two files, to be able to reuse what's there in what I added.

Copy link
Member

@markuspf markuspf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely think we need a more viable approach to testing libgap, for example (a) script(s) in the testdirectory that is executed instead of multiple make targets (and essentially shell scripts that are hidden in the Makefile).

@dimpase
Copy link
Member Author

dimpase commented Sep 21, 2018

Certainly, copy-pasting make targets is far from ideal. However, the workspace test is somewhat special, as we want to execute two applications in the correct order.

Perhaps we might also want to test that libgap-generated workspace loads in a "normal" GAP, and the other way around?

One way or another, the makefile rules probably would need to be adapted to become crossplatforms, taking filename suffixes into account.

@markuspf
Copy link
Member

Have a look at the tst/test-compile directory: It has some scripts that run the tests; I imagine something like this is a viable approach to testing libgap without polluting Makefile.rules.

@dimpase
Copy link
Member Author

dimpase commented Sep 21, 2018

Building would still need to be done by make. A part of the issue is that we'd like a generic rule to make an executable FOO linked against libgap and common.lo, something like:

        $(LINK) $(GAP_LDFLAGS) obj/tst/testlibgap/$(FOO).lo  obj/tst/testlibgap/common.lo  libgap.la -o test-libgap$(FOO)

However I'd rather leave it for an expert in GAP makefiles (@fingolfin ?) to implement.

Once this is there, writing a script invoking make and running tests won't be a problem.


We can also have a Makefile in tst/testlibgap/ to build tests.

@dimpase
Copy link
Member Author

dimpase commented Sep 23, 2018

I will try putting -L ... into args to the call to GAP_Initialize() - this will allow to have just one make target for all the tests affected by this PR.

@fingolfin
Copy link
Member

I already added such a build rule to this PR on friday, while you were sitting next to me. It is still there, and in use.

@dimpase
Copy link
Member Author

dimpase commented Sep 23, 2018 via email

@fingolfin
Copy link
Member

@dimpase My bad: I got a notification for your new comment on my smartphone, but it showed me the comment from before (from Friday 11 AM), due to that also being unread in my inbox; and I mistook that as being the comment you just had posted. But of course you really posted about the use of -L. Sorry :-(

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that this PR is still around, and hasn't really been reviewed. So here are some remarks. Perhaps @markuspf has more.

Perhaps this should be squashed into a single commit? Not sure how useful the history in this PR is at this point?

Makefile.rules Outdated
tst/testlibgap/%: obj/tst/testlibgap/%.lo obj/tst/testlibgap/common.lo libgap.la
$(QUIET_LINK)$(LINK) $(GAP_LDFLAGS) $^ -o $@
$(LINK) $(GAP_LDFLAGS) $^ -o $@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the QUIET_LINK dropped?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops. Just forgot to put it back...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added back

Makefile.rules Outdated
$(QUIET_LINK)$(LINK) $(GAP_LDFLAGS) $^ -o $@
$(LINK) $(GAP_LDFLAGS) $^ -o $@
$@ -A -l $(top_srcdir) -m 32m -q -T --nointeract > [email protected]
diff $(top_srcdir)/[email protected] [email protected]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree with this part of the change: IMHO, the build rules for the test executables should be separate from the (PHONY) rules that run the tests.

Indeed, right now these targets are not marked as .PHONY, so I expect (but did not try) that running make testlibgap twice will not actually run any tests the second time around.

One way to do this should be to remove the above two lines here again; and instead have a for loop in testlibgap which iterates over $^ (resp. tst/testlibgap/basic tst/testlibgap/wscreate tst/testlibgap/wsload) and for each executes the above code. That way, you also automatically get the order right.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in the latest commit

Makefile.rules Outdated
$@ -A -l $(top_srcdir) -m 32m -q -T --nointeract > [email protected]
diff $(top_srcdir)/[email protected] [email protected]

# rm -f [email protected]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

tst/testlibgap/wsload.c Show resolved Hide resolved
tst/testlibgap/wsload.c Show resolved Hide resolved
tst/testlibgap/common.h Show resolved Hide resolved
tst/testlibgap/wscreate.c Show resolved Hide resolved
@dimpase
Copy link
Member Author

dimpase commented Oct 30, 2018

@fingolfin : hopefully this addresses all your concerns; (I'd squash the commits then).

Makefile.rules Outdated

# run all the tests in tst/testlibgap
testlibgap: ${LIBGAPTESTS}
$(foreach v,$^,$(v) -A -l $(top_srcdir) -m 32m -q -T --nointeract >$(v).out; diff $(top_srcdir)/$(v).expect $(v).out;)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why set a minimum workspace size?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general this line seems very... clever. I have no idea at all what it's doing. If foreach a make thing? bash thing? While this isn't a requirement, I'd prefer this be a script in tst/testlibgap (but others might prefer it in here)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's make's foreach. I can probably format this line better, split it, if you like...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimum workspace size has been set in @markuspf 's original line in Makefile.rules to run the only available libgap's test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think reformatting this to cover multiple lines would improve the readability. I'd also drop the -m 32m -- if there was a reason for it, then it can be added back, but that time with a comment explaining it.

Other than that, this PR seems ready to me. Thank you for your persistence!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed in the latest commit.

@fingolfin
Copy link
Member

LGTM; perhaps do some squashing, though?

@dimpase
Copy link
Member Author

dimpase commented Oct 31, 2018

rebasing all this properly is a bit beyond my git skills, with all these interleaving commits that creeped in while pulling from master, sorry. I get weird-looking errors, like Could not apply 11a347740b8ba89352c41d75f62a4ac177c56f6...

@fingolfin
Copy link
Member

Hu, that's odd; just doing a git rebase master worked fine for me, followed by using git rebase -i to squash it.

took `-L ...` out of the command line
allow to build and run all the tests with just one makefile rule.
tests in testlibgap to run each time testlibgap target is made
also defined the list of tests and used it throughout.
Added a TODO in wscreate regarding workspace file naming
better formatting, remove -m option in libgap test calls
@dimpase
Copy link
Member Author

dimpase commented Oct 31, 2018

OK, I've managed to squeeze it to 4 commits.

@fingolfin fingolfin merged commit 3c110e7 into gap-system:master Nov 1, 2018
@fingolfin fingolfin added topic: libgap things related to libgap topic: tests issues or PRs related to tests release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes labels Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gapdays2018-fall Issues and PRs that arose at https://www.gapdays.de/gapdays2018-fall release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: libgap things related to libgap topic: tests issues or PRs related to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants