darcs

Patch 2377 Allow use of shared libraries in tests

Title Allow use of shared libraries in tests
Superseder Nosy List Vekhir
Related Issues
Status accepted Assigned To
Milestone

Created on 2024-03-08.11:38:36 by Vekhir, last changed 2024-03-24.09:47:54 by ganesh.

Files
File name Status Uploaded Type Edit Remove
add-a-__ghcflags__g-option-to-the-test-suite.dpatch ganesh, 2024-03-09.14:56:15 application/x-darcs-patch
patch-preview.txt ganesh, 2024-03-09.14:56:15 text/x-darcs-patch
See mailing list archives for discussion on individual patches.
Messages
msg23777 (view) Author: Vekhir Date: 2024-03-08.11:37:48
1 patch for repository http://darcs.net:

patch f1268fcebd00794d78c1bb4ea252d067b766bfe2
Author: Vekhir <vekhir@yahoo.com>
Date:   Thu Mar  7 14:01:21 CET 2024
   * Allow use of shared libraries in tests

   During testing, several Haskell programs are compiled. To build them 
correctly
   on systems with shared libraries, they must link to them dynamically.

   A new manual flag 'shared-libraries' adds '-dynamic' to every 
invocation of
   ghc if set, and otherwise does nothing.

New patches:

[Allow use of shared libraries in tests
Vekhir <vekhir@yahoo.com>**20240307130121
  Ignore-this: 
3860d1cf6fa5bf6d3c193969e7fb498d5cae7e87bc6bb0ed7eb42951a7acf8e90cde381165347c0e

  During testing, several Haskell programs are compiled. To build them 
correctly
  on systems with shared libraries, they must link to them dynamically.

  A new manual flag 'shared-libraries' adds '-dynamic' to every 
invocation of
  ghc if set, and otherwise does nothing.
] hunk ./darcs.cabal 116
+flag shared-libraries
+  description: Dynamically link to libraries during testing. Required 
when dependencies are built as shared objects.
+  default:     False
+  manual:      True
+
hunk ./darcs.cabal 570
+  if flag(shared-libraries)
+    cpp-options:    -DSHARED_LIBRARIES
+
hunk ./harness/Darcs/Test/Shell.hs 127
+#ifdef SHARED_LIBRARIES
+          , ("DYNAMIC"                   , EnvString "-dynamic")
+#else
+          , ("DYNAMIC"                   , EnvString "")
+#endif
hunk ./tests/issue1465_ortryrunning.sh 36
-ghc -o editor-good --make editor-good.hs
+ghc $DYNAMIC -o editor-good --make editor-good.hs
hunk ./tests/issue1465_ortryrunning.sh 42
-ghc -o editor-bad --make editor-bad.hs
+ghc $DYNAMIC -o editor-bad --make editor-bad.hs
hunk ./tests/issue1465_ortryrunning.sh 48
-ghc -o editor-gave-up --make editor-gave-up.hs
+ghc $DYNAMIC -o editor-gave-up --make editor-gave-up.hs
hunk ./tests/issue1465_ortryrunning.sh 55
-ghc -o vi --make vi.hs
+ghc $DYNAMIC -o vi --make vi.hs
hunk ./tests/issue189-external-merge-move.sh 46
-ghc --make external_merge.hs
+ghc $DYNAMIC --make external_merge.hs
hunk ./tests/issue2204-send-mail.sh 36
-ghc -o dummy-sendmail --make dummy-sendmail.hs
+ghc $DYNAMIC -o dummy-sendmail --make dummy-sendmail.hs
hunk ./tests/latin9-input.sh 135
-ghc --make -o editor editor.hs
+ghc $DYNAMIC --make -o editor editor.hs
hunk ./tests/network/external.sh 14
-ghc --make $fakessh.hs
+ghc $DYNAMIC --make $fakessh.hs
hunk ./tests/test-untestable.sh 41
-ghc --make -o runtest runtest.hs
+ghc $DYNAMIC --make -o runtest runtest.hs
hunk ./tests/trackdown-bisect.sh 16
-ghc -o trackdown-bisect-helper trackdown-bisect-helper.hs
+ghc $DYNAMIC -o trackdown-bisect-helper trackdown-bisect-helper.hs

Context:

[TAG 2.18.1
Ganesh Sittampalam <ganesh@earth.li>**20240225173219
  Ignore-this: 
dc3a92eafcab9d4fa9f53b1811d4c99d330615a8c202bff1b77f44d551d21684eee81e96c69be62b
]
Patch bundle hash:
5d25713c9afaa42e558fc3ccc644001b9d6b6315
msg23778 (view) Author: ganesh Date: 2024-03-09.14:56:15
1 patch for repository darcs-unstable@darcs.net:/opt/darcs/screened:

patch 1074abe379404ac2c8967b06a1f8e55304cb13ad
Author: Ganesh Sittampalam <ganesh@earth.li>
Date:   Sat Mar  9 14:54:22 GMT 2024
  * Add a --ghcflags/-g option to the test suite

  This allows arbitrary GHC flags to be passed on to the ghc
  invocations used to build helper exes in various test scripts.

  For example this allows -dynamic to be passed on systems with
  shared libraries.

  Based on a patch by Vekhir <vekhir@yahoo.com>
Attachments
msg23779 (view) Author: ganesh Date: 2024-03-09.15:02:16
I discussed the use of the flag a bit with Vekhir on IRC. The logic
behind making it a cabal flag is that if you're building Darcs itself
dynamically, you might was well set up the test harness to run
dynamically too - but you can't easily detect how Darcs is being built
so the separate cabal flag is used instead.

In the end I decided on a slightly more general approach of allowing
any GHC flags which also then makes sense to put into the test harness 
options.

BTW I couldn't get darcs to parse the contents of the original patch,
and even worse it just kept producing an unhelpful error message
("string"). I spent a little while debugging that but then gave up
and just re-did it from scratch (which was somewhat necessary for
my approach anyway).

I think next time it's safest to send it as an attachment. Sorry for
the submission pain :-(
msg23784 (view) Author: ganesh Date: 2024-03-13.22:38:11
Vekhir has confirmed this works for their use case.
History
Date User Action Args
2024-03-08 11:38:36Vekhircreate
2024-03-09 14:56:16ganeshsetfiles: + patch-preview.txt, add-a-__ghcflags__g-option-to-the-test-suite.dpatch
messages: + msg23778
2024-03-09 15:02:18ganeshsetmessages: + msg23779
2024-03-13 22:38:11ganeshsetstatus: needs-screening -> accepted-pending-tests
messages: + msg23784
2024-03-24 09:47:54ganeshsetstatus: accepted-pending-tests -> accepted