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

Usability problems with '--enable-tests' (configure.ac) #3708

Closed
mc-butler opened this issue Oct 31, 2016 · 23 comments
Closed

Usability problems with '--enable-tests' (configure.ac) #3708

mc-butler opened this issue Oct 31, 2016 · 23 comments
Assignees
Labels
area: tests Testing Midnight Commander prio: low Minor problem or easily worked around
Milestone

Comments

@mc-butler
Copy link

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/3708
Reporter mooffie (@mooffie)

To enable tests, one has to pass --enable-tests to configure. But there are a few usability problems in this mechanism:

When the programmer doesn't pass --enable-tests:

In this case, the output on screen and the generated files falsely give the impression tests were enabled:

(1) The message "checking for CHECK..." appears.

(2) The makefiles under the 'tests' tree are generated, even though configure.ac has a conditional that's supposed to prevent this (i.e., if test x$enable_tests != xno).

When the programmer does pass --enable-tests:

(3) She doesn't have an easy way to know if tests were indeed successfully enabled. That's because error messages are very hard to spot, and because the test makefiles, because of (2), are created unconditionally and therefore can't serve as indicator.

Additionally:

(4) Instructions on how to enable the tests should appear where they're expected.


Are these usability problems grave?

Yes! People are #comment:49 wasting time (#3449) trying to figure out these issues by themselves.


The attached patch fixes these problems:

  • Problems (1) and (2) are caused by comparing $enable_tests with "no". But $enable_tests usually contains empty string in this case, not "no". We fix this.
  • We solve problem (3) by adding some text to the final summary message.
  • We solve problem (4) by adding a README file, in the place where it's expected.

Note

Original attachments:

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Nov 1, 2016 at 6:39 UTC (comment 1)

I think, tests/README should be added to the EXTRA_DIST in tests/Makefile.am, otherwise it will not be in distributed tarboll.

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Nov 1, 2016 at 8:24 UTC

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Nov 1, 2016 at 8:25 UTC (comment 1.2)

Replying to andrew_b:

I think, tests/README should be added to the EXTRA_DIST in tests/Makefile.am, otherwise it will not be in distributed tarboll.


Right. Fixed.

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Nov 1, 2016 at 11:50 UTC (comment 3)

  • Branch state changed from no branch to on review
  • Owner set to zaytsev
  • Status changed from new to accepted
  • Milestone changed from Future Releases to 4.8.19

Branch: 3708_tests_usability
Initial changeset: [7bfddbee743445bda4e0203960f8b40691396940]

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Nov 1, 2016 at 11:51 UTC (comment 4)

Awesome, thank you! Love it...

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Nov 1, 2016 at 12:03 UTC (comment 5)

Hmmm, Travis doesn't like it:

https://travis-ci.org/MidnightCommander/mc/builds/172262523

It seems that make dist is botched, need to see why; that's why I'm making so much fuss about CI: problem caught early before causing any damage.

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Nov 1, 2016 at 15:21 UTC (comment 5.6)

Replying to zaytsev:

Hmmm, Travis doesn't like it:

https://travis-ci.org/MidnightCommander/mc/builds/172262523

/bin/bash: line 10: cd: tests: No such file or directory
make: *** [distdir] Error 1

It seems that make dist is botched


I see.

So it turns out that makefiles can't be created conditionally, because they always have to be there to tell make how to create the distribution.

This means that --disable-tests would have triggered the problem too.

I'm attaching v2 of the patch. It removes the conditional from configure.ac.

(I haven't yet had the time to test this patch; it's quite tortuous to run 'make whatever' on my system (which is why I refrained from trying out 'make dist' earlier.))

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Nov 1, 2016 at 15:26 UTC

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Nov 1, 2016 at 15:46 UTC (comment 7)

(I haven't yet had the time to test this patch; it's quite tortuous to run 'make whatever' on my system (which is why I refrained from trying out 'make dist' earlier.))

We've talked about that in the past and the obvious solution was rejected, but here are a few more (hopefully acceptable) suggestions:

  • You can use the Travis integration that I have developed to offload exhaustive testing to their VMs, just fork the repository to your account and enable Travis for it; you will get notifications from Travis if stuff you push to it doesn't work. (Careful about master branch builds, they will try to deploy source indices which will fail for your account.)
  • A long time ago, mc was regularly built with tcc; it is quite possible that this no longer works, but if you manage to get it going, I wouldn't be surprised about an x10 speedup.
  • I think I've mentioned ccache already at some point...

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Nov 1, 2016 at 16:31 UTC (comment 7.8)

Ok, I've verified that 'make dist' works. Which is not surprising now as the patch no longer contains fancy stuff: it contributes just a "Unit tests: X" summary line and a README. Well, it's better than the current situation.

(@yury: Thanks. I'll have a look at ccache soon (heard of it before but I guess I was sceptical). Then tcc. (I've already tried memory filesystem and clang, but they weren't much an improvement.))

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Nov 1, 2016 at 16:57 UTC (comment 9)

I've already tried memory filesystem and clang, but they weren't much an improvement.

Yes, for a project like mc, tmpfs + clang won't bring much, but even with large C++ projects, clang is not that much faster than gcc these days. I would expect tmpfs + tcc to really rock though, if it works at all.

I'll have a look at ccache soon (heard of it before but I guess I was sceptical).

ccache is very nice as long as you don't often change stuff that ripples all over the code base, such that effectively you'll have to recompile everything anyways, and thus it will be of little help; it all depends on your workflow. In the case of mc, the config.h / version.h thing will, unfortunately, effectively kill the caching upon new commits, but since my compile times are very low, I never cared enough to disentangle this stuff and put version strings in a separate object file.

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Nov 2, 2016 at 21:32 UTC (comment 10)

  • Branch state changed from on review to on rework

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Dec 25, 2016 at 17:06 UTC (comment 11)

  • Branch state changed from on rework to on review

Branch: 3708_tests_usability
Initial changeset: [b5cc581744677921ad6d78d176243d148820566f]

Rebased the new patch against latest master, Travis build seems to pass now.

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Dec 25, 2016 at 17:57 UTC (comment 12)

  • Branch state changed from on review to on rework

Folks,

At some moment in the past two months I got a jolt of Psychic Insight. It lasted for only a second but as it was flowing through me it occured to me that the intention of the original author of mc-tests.m4 was for '--enable-tests' to effectively be the default.

This makes a thing or two seem logical now.

So, seen in this new light, the patch needs work. I'll do this sometime soon.

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Dec 25, 2016 at 18:11 UTC (comment 12.13)

Replying to mooffie:

So, seen in this new light, the patch needs work.


(First, of course, checking whether the current configuration works as intended.)

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Dec 25, 2016 at 18:15 UTC (comment 14)

I'm not quite sure this was Slava's intention, otherwise he would have added action-if-given / action-if-not-given as he did to many other similar options, but I would definitively approve of a plan to enable them by default if check is found. Whatever makes tests easier to build and run is a good thing (tm)

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Dec 27, 2016 at 0:42 UTC (comment 15)

Ok, here's the revised patch. Tests are now enabled by default. No reason not to.

@mc-butler
Copy link
Author

Changed by mooffie (@mooffie) on Dec 27, 2016 at 0:44 UTC

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Dec 27, 2016 at 7:23 UTC (comment 16)

  • Branch state changed from on rework to on review

Branch: 3708_tests_usability
Initial changeset: [9d74b18afa37b3e9eeae4ad2c1fbfce9a8f2907c]

Third attempt ;-)

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Dec 27, 2016 at 7:40 UTC (comment 17)

Please add "Ticket #3708:" to the commit message.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Dec 27, 2016 at 7:53 UTC (comment 18)

  • Branch state changed from on review to approved
  • Votes set to andrew_b

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Dec 27, 2016 at 12:52 UTC (comment 19)

  • Resolution set to fixed
  • Branch state changed from approved to merged
  • Votes changed from andrew_b to committed-master
  • Status changed from accepted to testing

Merged to master: [67b3d64]

Sorry, Andrew, I totally forgot about this, thanks for the reminder.

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Dec 27, 2016 at 13:42 UTC (comment 20)

  • Status changed from testing to closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: tests Testing Midnight Commander prio: low Minor problem or easily worked around
Development

No branches or pull requests

2 participants