Patch 2021 replace shelly with turtle

Title replace shelly with turtle
Superseder Nosy List bf
Related Issues
Status in-discussion Assigned To

Created on 2020-05-19.10:05:21 by bf, last changed 2020-06-20.07:29:58 by bf.

File name Status Uploaded Type Edit Remove
bump-shelly-version-to-1_7_1_1-to-avoid-conflict-with-official-version.dpatch bf, 2020-05-19.10:05:17 application/x-darcs-patch
harnes_tests_-import-lib-in-all-test-scripts_-no-longer-set-env-in-haskell.dpatch bf, 2020-05-20.09:43:42 text/plain
patch-preview.txt bf, 2020-05-19.10:05:17 text/x-darcs-patch
test2.dpatch bf, 2020-05-21.05:56:17 text/plain
unnamed bf, 2020-05-19.10:05:17 text/plain
See mailing list archives for discussion on individual patches.
msg22021 (view) Author: bf Date: 2020-05-19.10:05:17
This bundle first pulls a few more patches from branch-2.14 before making
the switch from shelly to turtle. It also fixes a number of bugs in test
scripts, some of which have been uncovered by the shelly->turtle refactor;
others came up during the investigation of test falures and are also
included here.

I have run the test suite with all supported ghc versions (8.2 .. 8.10), but
only on Linux (Ubuntu 18.04). Please, Ganesh, can you try running the test
suite on Windows with this bundle applied? I won't screen it until I get
confirmation that it doesn't break anything substantial.

21 patches for repository http://darcs.net/screened:

patch 084e35c8083dc0fbbeb28c9a41f383c78c101a0d
Author: Ben Franksen <ben.franksen@online.de>
Date:   Tue Apr 28 16:22:42 CEST 2020
  * bump shelly version to to avoid conflict with official version

patch 29bb91390b2b1d5066fc86d031b6f531a42e7275
Author: Ben Franksen <ben.franksen@online.de>
Date:   Wed Apr 29 11:49:34 CEST 2020
  * re-word the package description
  The motivation here was to explain better what makes Darcs different from
  other revision control systems. It is a bit more technical now and points
  out the conceptual simplicity that makes Darcs unique.

patch eb38e64eb542e475f64102a35acda3a94c16c5c5
Author: Ben Franksen <ben.franksen@online.de>
Date:   Wed Apr 29 12:27:43 CEST 2020
  * lots of updates to README.md
  This removes the link to http://darcs.net/Binaries, clarifies build
  instructions and documents limitations with respect to running the tests.
  The examples for running darcs have been reformatted and extended.
  Other sections have been partly re-worded and extended for clarity.

patch d09a942fd27365388bde0da8e1757eef3d9118c6
Author: Ben Franksen <ben.franksen@online.de>
Date:   Tue Apr 28 12:48:17 CEST 2020
  * add release notes for 2.14.4

patch e6c04d3fdf3fc5ee2ee083595ad213fcc2851dcd
Author: Ben Franksen <ben.franksen@online.de>
Date:   Thu Apr 30 13:34:11 CEST 2020
  * fix another instance where fail->error was wrong

patch 9265001d8f5c159b4bab4f0b1ec574754bfe01a0
Author: Ben Franksen <ben.franksen@online.de>
Date:   Fri May  1 14:15:11 CEST 2020
  * harness: use turtle to find the darcs executable to test
  This is a first step toward refactoring harness/test.hs to get rid of the
  shelly dependency.

patch 02e55fa4bfb0f785f7c24efe7a4257d70c3cea97
Author: Ben Franksen <ben.franksen@online.de>
Date:   Fri May  1 14:26:45 CEST 2020
  * harness: use PatchFormat and DiffAlgorithm from Darcs.Repository.Flags

patch b2d0d11007ec22e816bbe14641076091aa2e9474
Author: Ben Franksen <ben.franksen@online.de>
Date:   Fri May  1 16:48:03 CEST 2020
  * harness: use RecordWildCards in test.hs

patch 5b5dc69a13fde05309a5b57cd01b2e9b04f2df29
Author: Ben Franksen <ben.franksen@online.de>
Date:   Fri May  1 18:52:27 CEST 2020
  * harnes,tests: import lib in all test scripts, no longer set env in Haskell
  This slightly simplifies the environment handling logic in the harness.

patch a0528921a72d3130c70f791bd1d0b1414a77bbf0
Author: Ben Franksen <ben.franksen@online.de>
Date:   Fri May  1 21:10:30 CEST 2020
  * harness: further simplify environment logic for PATH
  Instead of splitting and reconstructing the PATH variable, just prepend the
  directory of the darcs under test directly in the env file.

patch 3ce7bddd7ca86c5d6ac52942db8fd55bdc8db8f6
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sun May  3 12:33:23 CEST 2020
  * remove dependency on FindBin package
  We had System.Environment.getExecutablePath starting with base-4.6.

patch d101ae051e27711bb7747c225c1a1cdedd7baecd
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat May  2 01:06:10 CEST 2020
  * replace dependency on shelly with turtle
  This has been more difficult than I expected. There are two points where
  turtle is weaker than shelly: first, the 'cd' and 'setenv' commands are not
  thread-safe, whereas in shelly they are; second, in turtle (as in the
  standard System.Process) there is no way to intercept the handles that are
  created when we specify that they should be captured using pipes. Again,
  shelly offers this as a feature.
  The solution for the first problem is to not set the environment and to not
  use 'cd'. Instead we pass the working directory directly to the process that
  runs the shell script. The second problem is solved using some low-level
  primitives from System.Process.

patch 31f2953b33a4a713544c22eac8c09b3446f9e91a
Author: Ben Franksen <ben.franksen@online.de>
Date:   Mon May 18 10:58:02 CEST 2020
  * fix creation of temporary directories
  The algorithm we used to generate a unique name is prone to race conditions
  and I occasionally got random test failures because of this. The new
  implementation uses the temporary package.

patch 703f4375e2e7fbdd4a7f9f8dd724f4651f1ac76b
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat May  2 16:30:47 CEST 2020
  * bugfix in tests/mutex-option-precedence.sh
  It included lib from an invalid location.

patch 7681ac3dc1dec84895a9e431bf1eec0df1c8c7c9
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat May  2 16:28:19 CEST 2020
  * bugfixes in tests/mark-conflicts.sh
  The pull command sends the completion message to stdout, but the conflict is
  reported on stderr. The completion message is now capitalized, so grep -i is
  more appropriate.

patch 3fd7bd45003766c2e90e3ce081d4902b52d11d8f
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat May  2 16:24:54 CEST 2020
  * bugfix in tests/issue494-pending-sort.sh
  The whatsnew command returns failure of there are no unrecorded changes.

patch f251770c5b681ca6ee88ae77a4db77a622a6aa32
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat May  2 16:22:31 CEST 2020
  * bugfix in tests/issue1609-conflict-markup-depends-on-patch-order.sh
  The pull command now always asks for confirmation if there are conflicts
  with unrecorded changes.

patch cfab1d585c13740e95d960de576f59be9a6da602
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat May  2 16:14:06 CEST 2020
  * tests: various minor cleanups

patch 227f83b63ea08d043aadc0d519b60b71e96e9612
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sat May  2 16:19:21 CEST 2020
  * bugfix in tests/issue1609-conflict-markup-depends-on-patch-order.sh
  Using the bash built-in echo here made this test randomly fail for me when I
  run the tests in parallel.

patch 7f3b23cf8e1cb121ccc4b882ee3edc139bb92449
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sun May  3 21:36:15 CEST 2020
  * tests/lib: the 'not' function should not hide darcs crashes
  When the command invoked is darcs, an exit code of 4 means darcs is
  reporting a bug. This should /never/ counted as success, even if the darcs
  command is supposed to fail.

patch acba4db98106baf900a55de42c918a584fdc7f7b
Author: Ben Franksen <ben.franksen@online.de>
Date:   Sun May  3 21:39:44 CEST 2020
  * mark test for issue1879 as failing
  In this test darcs actually crashes. This was previously hidden by the 'not'
  shell function. We should provide a cleaner and more thorough solution to
  check for patch integrity.
msg22022 (view) Author: ganesh Date: 2020-05-19.20:55:49
Unfortunately all the shell tests fail without any output at all (just

I quickly tried poking around re-running one of them by hand but didn't
spot anything obvious. I'll take a closer look when I have a bit more time.
msg22023 (view) Author: bf Date: 2020-05-20.09:43:50
> Unfortunately all the shell tests fail without any output at all (just
> '[failed]').

This probably means that the call to createProcess_ (that runs "bash
test" inside the test directory) fails.

I have attached a patch that replaces the low-level call to
createProcess_ with a high-level one from turtle. On my system this will
report a number of failed tests because stderr and stdout have not been
set to binary mode.

Can you check that with this patch you can run at least
tests/harness.sh? If that succeeds it confirms that I have made a
mistake with the low-level call to createProcess_. If it fails, we
should at least get some output, unless systemStrictWithErr from turtle
is broken, too, in which case I can file a bug report with turtle.
msg22024 (view) Author: ganesh Date: 2020-05-20.18:21:56
> If it fails, we
> should at least get some output, unless systemStrictWithErr from turtle
> is broken, too, in which case I can file a bug report with turtle.

It failed with no output. But I should probably dig into it more before
we declare turtle is broken, maybe I'm doing something silly.

I have this patch:

Date:   Wed May 20 10:40:06 GMT Summer Time 2020

and I'm running

$ cabal v2-run test:darcs-test -- --unit=no -t harness
msg22026 (view) Author: bf Date: 2020-05-21.05:56:22
> It failed with no output. But I should probably dig into it more before
> we declare turtle is broken,


> maybe I'm doing something silly.

I don't think so. Patch and command are fine.

Attached is a second test patch you could try. This one catches all
exceptions from the whole process thing and wraps the exception in a
Failed. We definitely should see /something/ now when you run the test
msg22028 (view) Author: ganesh Date: 2020-05-21.21:34:20
Still no output..though perhaps it would be more accurate to say there's
a single blank line. I didn't mention that before as the printing of tests 
on Windows has tended to have that anyway:

harness (darcs-1,patience): [Failed]

harness (darcs-2,patience): [Failed]

I put in some instrumentation and established that it is hitting the normal
failure case

    | otherwise -> return (Failed err)

But err is just "".
msg22033 (view) Author: ganesh Date: 2020-05-31.17:01:49
I spent a little bit longer digging into this and discovered that
it's ending up calling the Windows Subsystem for Linux bash, instead
of the mingw one. The WSL bash is on my path from a command prompt, the
mingw one is on my path in a mingw shell, where I run the test harness from.

So arguably this is a screwup in my setup that the current harness happens
to avoid. If I try to run the current test harness from a Windows command 
prompt, I get similar behaviour (failure with no output).

I'll need to dig a bit more to see what happens if (a) I change my setup
so the default bash on the path is always the mingw one and/or (b) if we
can make the new code find the one from the mingw path. Just making a note
of what I've learnt so far in case I don't get to that immediately.
msg22034 (view) Author: ganesh Date: 2020-05-31.17:05:36
Also, the failure was hard to see because the WSL bash output was to print
a message saying its not setup properly on stdout, nothing on stderr, and a
-1 exit code. Since the test harness is only trying to print out stderr,
this was not helpful :-)
Date User Action Args
2020-05-19 10:05:21bfcreate
2020-05-19 20:55:50ganeshsetmessages: + msg22022
2020-05-20 09:43:50bfsetfiles: + harnes_tests_-import-lib-in-all-test-scripts_-no-longer-set-env-in-haskell.dpatch
messages: + msg22023
2020-05-20 18:21:56ganeshsetmessages: + msg22024
2020-05-21 05:56:23bfsetfiles: + test2.dpatch
messages: + msg22026
2020-05-21 21:34:21ganeshsetmessages: + msg22028
2020-05-31 17:01:50ganeshsetmessages: + msg22033
2020-05-31 17:05:36ganeshsetmessages: + msg22034
2020-06-20 07:29:58bfsetstatus: needs-screening -> in-discussion