all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] tests: Use '.' and not 'source' which is a Bashism.
@ 2015-05-06 18:18 Taylan Ulrich Bayırlı/Kammer
  2015-05-06 19:32 ` John Darrington
  0 siblings, 1 reply; 5+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-05-06 18:18 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 104 bytes --]

I assume the test is supposed to run with any standards compliant shell
and not specifically GNU Bash:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-tests-Use-.-and-not-source-which-is-a-Bashism.patch --]
[-- Type: text/x-diff, Size: 1061 bytes --]

From 45b02e923e835569c47e4e5b4dd6972ac402a74e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Wed, 6 May 2015 20:13:31 +0200
Subject: [PATCH] tests: Use '.' and not 'source' which is a Bashism.

* tests/profiles.scm ("etc/profile"): Use '.' instead of 'source', since the
  latter is a Bashism and not necessarily supported by a standard shell.
---
 tests/profiles.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/profiles.scm b/tests/profiles.scm
index a397171..93801a0 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -237,8 +237,7 @@
     (mbegin %store-monad
       (built-derivations (list drv))
       (let* ((pipe (open-input-pipe
-                    (string-append "source "
-                                   profile "/etc/profile; "
+                    (string-append ". " profile "/etc/profile; "
                                    "unset GUIX_PROFILE; set")))
              (env  (get-string-all pipe)))
         (return
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] tests: Use '.' and not 'source' which is a Bashism.
  2015-05-06 18:18 [PATCH] tests: Use '.' and not 'source' which is a Bashism Taylan Ulrich Bayırlı/Kammer
@ 2015-05-06 19:32 ` John Darrington
  2015-05-06 20:08   ` Taylan Ulrich Bayırlı/Kammer
  0 siblings, 1 reply; 5+ messages in thread
From: John Darrington @ 2015-05-06 19:32 UTC (permalink / raw)
  To: Taylan Ulrich Bay??rl??/Kammer; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

On Wed, May 06, 2015 at 08:18:47PM +0200, Taylan Ulrich Bay??rl??/Kammer wrote:
     I assume the test is supposed to run with any standards compliant shell
     and not specifically GNU Bash:

Since we use bash, I don't think it matters if we have constructs which don't
work on the traditional bourne shell.
     


-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tests: Use '.' and not 'source' which is a Bashism.
  2015-05-06 19:32 ` John Darrington
@ 2015-05-06 20:08   ` Taylan Ulrich Bayırlı/Kammer
  2015-05-06 20:17     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-05-06 20:08 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

John Darrington <john@darrington.wattle.id.au> writes:

> Since we use bash, I don't think it matters if we have constructs
> which don't work on the traditional bourne shell.

This is about building Guix though, which should work on any POSIX
system (approximately at least?) with the dependencies listed in the
README.

By the way it seems that wasn't the only issue in the test.  Here is a
better patch, this time tested on Debian with /bin/sh set to dash:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-tests-Fix-etc-profile-test.patch --]
[-- Type: text/x-diff, Size: 1622 bytes --]

From f165e9a91118936e72f7df836446541c093c8329 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Wed, 6 May 2015 20:13:31 +0200
Subject: [PATCH] tests: Fix etc/profile test.

* tests/profiles.scm ("etc/profile"): Unset GUIX_PROFILE before sourcing
  etc/profile.  Use '.' instead of 'source' for sourcing, since the latter is
  a Bashism.  Call 'echo $PATH' instead of using the output of 'set' to
  determine whether PATH is set, because the output of 'set' differs between
  shells.
---
 tests/profiles.scm | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/profiles.scm b/tests/profiles.scm
index a397171..6b1a907 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -237,14 +237,13 @@
     (mbegin %store-monad
       (built-derivations (list drv))
       (let* ((pipe (open-input-pipe
-                    (string-append "source "
-                                   profile "/etc/profile; "
-                                   "unset GUIX_PROFILE; set")))
-             (env  (get-string-all pipe)))
+                    (string-append "unset GUIX_PROFILE; "
+                                   ". " profile "/etc/profile; "
+                                   "echo $PATH")))
+             (path (get-string-all pipe)))
         (return
          (and (zero? (close-pipe pipe))
-              (string-contains env
-                               (string-append "PATH=" profile "/bin"))))))))
+              (string-contains path (string-append profile "/bin"))))))))
 
 (test-end "profiles")
 
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] tests: Use '.' and not 'source' which is a Bashism.
  2015-05-06 20:08   ` Taylan Ulrich Bayırlı/Kammer
@ 2015-05-06 20:17     ` Ludovic Courtès
  2015-05-06 20:36       ` Taylan Ulrich Bayırlı/Kammer
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2015-05-06 20:17 UTC (permalink / raw)
  To: Taylan Ulrich "Bayırlı/Kammer"; +Cc: guix-devel

taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") skribis:

> John Darrington <john@darrington.wattle.id.au> writes:
>
>> Since we use bash, I don't think it matters if we have constructs
>> which don't work on the traditional bourne shell.
>
> This is about building Guix though, which should work on any POSIX
> system (approximately at least?) with the dependencies listed in the
> README.

Yes.

> By the way it seems that wasn't the only issue in the test.  Here is a
> better patch, this time tested on Debian with /bin/sh set to dash:
>
>
> From f165e9a91118936e72f7df836446541c093c8329 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
>  <taylanbayirli@gmail.com>
> Date: Wed, 6 May 2015 20:13:31 +0200
> Subject: [PATCH] tests: Fix etc/profile test.
>
> * tests/profiles.scm ("etc/profile"): Unset GUIX_PROFILE before sourcing
>   etc/profile.  Use '.' instead of 'source' for sourcing, since the latter is
>   a Bashism.  Call 'echo $PATH' instead of using the output of 'set' to
>   determine whether PATH is set, because the output of 'set' differs between
>   shells.

Good catch!  Looks good to me.

Could you move the explanations (after “since” and “because”) as
comments in the source, and push afterwards?

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] tests: Use '.' and not 'source' which is a Bashism.
  2015-05-06 20:17     ` Ludovic Courtès
@ 2015-05-06 20:36       ` Taylan Ulrich Bayırlı/Kammer
  0 siblings, 0 replies; 5+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-05-06 20:36 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

ludo@gnu.org (Ludovic Courtès) writes:

> Could you move the explanations (after “since” and “because”) as
> comments in the source, and push afterwards?

Done and pushed, thanks for the review.

Taylan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-06 20:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-06 18:18 [PATCH] tests: Use '.' and not 'source' which is a Bashism Taylan Ulrich Bayırlı/Kammer
2015-05-06 19:32 ` John Darrington
2015-05-06 20:08   ` Taylan Ulrich Bayırlı/Kammer
2015-05-06 20:17     ` Ludovic Courtès
2015-05-06 20:36       ` Taylan Ulrich Bayırlı/Kammer

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.