aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2022-01-31 15:14:25 +0100
committerDanny Milosavljevic <dannym@scratchpost.org>2022-01-31 16:38:53 +0100
commita0bf73143b3662a0b902a06928977f6aeb97573c (patch)
tree5866f147cd505f9c31122389223d1fe370dfa552
parent7fc8a6faf6269fd6417e3ed4794504f66899432b (diff)
downloadguix-a0bf73143b3662a0b902a06928977f6aeb97573c.tar
guix-a0bf73143b3662a0b902a06928977f6aeb97573c.tar.gz
gnu: ruby-mustache: Fix race condition.
* gnu/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch: New file. * gnu/packages/ruby.scm (ruby-mustache)[source]<#:origin>: Add it. * gnu/local.mk (dist_patch_DATA): Add it.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch38
-rw-r--r--gnu/packages/ruby.scm11
3 files changed, 49 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 9f6966b0cd..fc1cd93fb2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1781,6 +1781,7 @@ dist_patch_DATA = \
%D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch \
%D%/packages/patches/rocm-opencl-runtime-4.3-nocltrace.patch \
%D%/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch \
+ %D%/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch \
%D%/packages/patches/ruby-sanitize-system-libxml.patch \
%D%/packages/patches/rustc-1.39.0-src.patch \
%D%/packages/patches/rust-adblock-ignore-live-tests.patch \
diff --git a/gnu/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch b/gnu/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch
new file mode 100644
index 0000000000..5d5bbaa4d0
--- /dev/null
+++ b/gnu/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch
@@ -0,0 +1,38 @@
+From 407c6a5db6c1f1cfb40bd6113f07f067d07885a4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
+Origin: https://github.com/mustache/mustache/pull/258
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954503
+Date: Mon, 27 Apr 2020 11:16:17 +0200
+Subject: [PATCH] Fix test race condition.
+
+The test suite randomly fails with errors such as:
+
+~~~
+ 1) Failure:
+AutoloadingTest#test_autoload_lowercase [/builddir/build/BUILD/mustache-1.1.1/usr/share/gems/gems/mustache-1.1.1/test/autoloading_test.rb:17]:
+Expected: Comments
+ Actual: nil
+~~~
+
+This happens when `test_namespaced*` test cases are executed earlier
+than the remaining test cases, because they are defining
+`view_namespace` but not cleaning up afterwards.
+---
+ test/autoloading_test.rb | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/test/autoloading_test.rb b/test/autoloading_test.rb
+index 0a7ad762..77eb3557 100644
+--- a/test/autoloading_test.rb
++++ b/test/autoloading_test.rb
+@@ -7,6 +7,10 @@ def setup
+ Mustache.view_path = File.dirname(__FILE__) + '/fixtures'
+ end
+
++ def teardown
++ Mustache.remove_instance_variable(:@view_namespace) if Mustache.instance_variable_defined?(:@view_namespace)
++ end
++
+ def test_autoload
+ klass = Mustache.view_class(:Comments)
+ assert_equal Comments, klass
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 9d1a414914..1632ad092b 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -11386,7 +11386,16 @@ serves JavaScript, CoffeeScript, CSS, LESS, Sass, and SCSS.")
(base32 "1l0p4wx15mi3wnamfv92ipkia4nsx8qi132c6g51jfdma3fiz2ch"))))
(build-system ruby-build-system)
(native-inputs
- (list ruby-simplecov))
+ `(("ruby-simplecov" ,ruby-simplecov)
+ ("test-patch"
+ ,(search-patch "ruby-mustache-1.1.1-fix-race-condition-tests.patch"))))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-tests
+ (lambda* (#:key inputs #:allow-other-keys)
+ (invoke "patch" "-p1" "--batch" "-i"
+ (assoc-ref inputs "test-patch")))))))
(synopsis "framework-agnostic way to render logic-free views")
(description
"Mustache is a framework-agnostic way to render logic-free views.