test.check

Support for bootstrapped / self-host ClojureScript

Details

  • Type: Enhancement Enhancement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Patch:
    Code and Test

Description

Revise test.check so that it can be used in bootstrapped environments. Additionally, add an ability to regression-test test.check for bootstrapped use.

Rationale: ClojureScript libraries and/or applications may wish to target bootstrapped ClojureScript while also making use of test.check.

Background: The cljs.test library has recently been ported for use with bootstrapped ClojureScript. (CLJS-1626). It has been shown that the test.check library can be made work with minor modification (removal of the :clj reader conditional guarding defspec). Further work would need to be done to ensure that such a modification is acceptable and that test.check's unit tests can be executed in a bootstrap environment (perhaps via a script running the tests in Node.)

  1. TCHECK-105.patch
    04/May/16 10:23 PM
    21 kB
    Mike Fikes
  2. TCHECK-105-2.patch
    04/Sep/16 3:52 PM
    22 kB
    Mike Fikes

Activity

Hide
Mike Fikes added a comment -

Attached TCHECK-105.patch. The commit comment in it, along with comments near the changed code provide details regarding the patch. Happy to elaborate or further revise if needed.

Show
Mike Fikes added a comment - Attached TCHECK-105.patch. The commit comment in it, along with comments near the changed code provide details regarding the patch. Happy to elaborate or further revise if needed.
Hide
Mike Fikes added a comment -

With the ClojureScript 1.9.36 release, the latest shipping cljs.jar will now encode compiler analysis metadata cache files as Transit by default, and the self-host test framework in TCHECK-105.patch is not set up to read Transit files from within self-hosted ClojureScript. (The self-host tests will operate with the cljs.jar that shipped with the 1.9.14 release.)

While this could probably be addressed by sorting out how to get the test framework to read the Transit files, CLJS-1666 provides another route: A flag will potentially be added that will cause the ClojureScript compiler to emit edn files instead.

Show
Mike Fikes added a comment - With the ClojureScript 1.9.36 release, the latest shipping cljs.jar will now encode compiler analysis metadata cache files as Transit by default, and the self-host test framework in TCHECK-105.patch is not set up to read Transit files from within self-hosted ClojureScript. (The self-host tests will operate with the cljs.jar that shipped with the 1.9.14 release.) While this could probably be addressed by sorting out how to get the test framework to read the Transit files, CLJS-1666 provides another route: A flag will potentially be added that will cause the ClojureScript compiler to emit edn files instead.
Hide
Mike Fikes added a comment -

Hey Gary, CLJS-1666 hasn't been addressed (and I think there is a desire to avoid addressing CLJS-1666 unless absolutely necessary). Is resolving the Transit issue a precondition for accepting this patch? (A consequence of not sorting this out is that the self-host portion of the unit tests included with the patch can only be executed using ClojureScript 1.9.14, until a solution exists.)

Show
Mike Fikes added a comment - Hey Gary, CLJS-1666 hasn't been addressed (and I think there is a desire to avoid addressing CLJS-1666 unless absolutely necessary). Is resolving the Transit issue a precondition for accepting this patch? (A consequence of not sorting this out is that the self-host portion of the unit tests included with the patch can only be executed using ClojureScript 1.9.14, until a solution exists.)
Hide
Gary Fredericks added a comment -

So the worst case is just that we're not catching self-hosting regressions, is that right? That's fine with me, since that situation seems strictly better than not doing anything at all.

I'm still planning to accept this patch, as soon as I can get some time to plan the next release of test.check more generally.

Show
Gary Fredericks added a comment - So the worst case is just that we're not catching self-hosting regressions, is that right? That's fine with me, since that situation seems strictly better than not doing anything at all. I'm still planning to accept this patch, as soon as I can get some time to plan the next release of test.check more generally.
Hide
Mike Fikes added a comment -

Gary, yes, that's correct: There could be some change in ClojureScript 1.9.36 or later that causes a regression for test.check when used in self-host mode that won't be possible to easily catch using the regression test capability built into the patch until the Transit issue is addressed.

Show
Mike Fikes added a comment - Gary, yes, that's correct: There could be some change in ClojureScript 1.9.36 or later that causes a regression for test.check when used in self-host mode that won't be possible to easily catch using the regression test capability built into the patch until the Transit issue is addressed.
Hide
Gary Fredericks added a comment -

Now that I'm rereading the comments, it sounds like we could have automated tests just by adding transit? If it's not difficult, I'd definitely prefer tests, since the code is uglier this well and I'll be forever tempted to make it nicer .

If so, I'd also prefer that most of the technical explanation live wherever the entrypoint to the tests is, with the inline comments just pointing to that.

Is there a reason why cljs.jar or something equivalent can't be obtained through maven?

Sorry for the slow turnaround.

Show
Gary Fredericks added a comment - Now that I'm rereading the comments, it sounds like we could have automated tests just by adding transit? If it's not difficult, I'd definitely prefer tests, since the code is uglier this well and I'll be forever tempted to make it nicer . If so, I'd also prefer that most of the technical explanation live wherever the entrypoint to the tests is, with the inline comments just pointing to that. Is there a reason why cljs.jar or something equivalent can't be obtained through maven? Sorry for the slow turnaround.
Hide
Mike Fikes added a comment -

Hi Gary, I'll see if I can get it to work with perhaps a special lein profile that specifies the latest ClojureScript along with Transit for the purposes of testing under self-hosted ClojureScript. That way there'd be no need to manually download anything and tests could be run in an automated fashion by just running script/test-self-host.

I'll also need to update things for the latest stuff in master of test.check.

Show
Mike Fikes added a comment - Hi Gary, I'll see if I can get it to work with perhaps a special lein profile that specifies the latest ClojureScript along with Transit for the purposes of testing under self-hosted ClojureScript. That way there'd be no need to manually download anything and tests could be run in an automated fashion by just running script/test-self-host. I'll also need to update things for the latest stuff in master of test.check.
Hide
Mike Fikes added a comment -

Hi Gary, TCHECK-105-2.patch attached for your comment.

This revision passes when applied to master (you simply need to run script/test-self-host).

It makes use of lein to obtain the latest ClojureScript JAR (employing a special profile for self host). This differs from the previous patch which required you to manually grab cljs.jar and place it in the lib directory.

Since it depends on the shipping ClojureScript dep (and not the standalone cljs.jar, which bakes in Transit), the entire Transit issue is sidestepped: The ClojureScript compiler only emits Transit if the Transit dep is present; since it is not with this revision, everything works in terms of EDN.

Happy to revise things, and comment where you believe could be helpful, as you see fit.

Show
Mike Fikes added a comment - Hi Gary, TCHECK-105-2.patch attached for your comment. This revision passes when applied to master (you simply need to run script/test-self-host). It makes use of lein to obtain the latest ClojureScript JAR (employing a special profile for self host). This differs from the previous patch which required you to manually grab cljs.jar and place it in the lib directory. Since it depends on the shipping ClojureScript dep (and not the standalone cljs.jar, which bakes in Transit), the entire Transit issue is sidestepped: The ClojureScript compiler only emits Transit if the Transit dep is present; since it is not with this revision, everything works in terms of EDN. Happy to revise things, and comment where you believe could be helpful, as you see fit.
Hide
Gary Fredericks added a comment -

I just applied the patch to master, thanks for putting it together!

Unless self-hosted cljs becomes rather more popular, I'm not planning on putting active effort into supporting it, but I intend to at least keep the tests passing. If there's any particular regression you're worried about, feel free to add more tests.

Show
Gary Fredericks added a comment - I just applied the patch to master, thanks for putting it together! Unless self-hosted cljs becomes rather more popular, I'm not planning on putting active effort into supporting it, but I intend to at least keep the tests passing. If there's any particular regression you're worried about, feel free to add more tests.
Hide
Mike Fikes added a comment -

Thanks Gary!

Show
Mike Fikes added a comment - Thanks Gary!

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: