Jérôme Charaoui pushed to branch master at Debian Java Maintainers / jruby


Commits:
942c9244 by Jérôme Charaoui at 2022-12-12T10:14:02-05:00
d/tests: create writeable GEM_PATH in custom directory

Instead of adding all system gems to jruby, which might cause problems
down the line, build a custom GEM_HOME by copying the default one under
/usr/share/jruby/lib/ruby/shared/gems and copying the test dependency
gems (rake, spec, etc.) from the system libraries.

- - - - -


3 changed files:

- debian/tests/common.sh
- debian/tests/control
- debian/tests/jgem


Changes:

=====================================
debian/tests/common.sh
=====================================
@@ -9,8 +9,28 @@ prepare() {
     export LC_ALL=C.UTF-8
     export CI=1
     export JOBS=2
-    # make test dependencies (bundle gems) in system gems available to jruby
-    export 
GEM_PATH=/usr/share/rubygems-integration/all:/usr/lib/ruby/gems/3.1.0
+
+    # create a writeable GEM_HOME in /tmp
+    # with extra gems needed to run the testsuite
+    rm -rf /tmp/jruby_gems
+    mkdir /tmp/jruby_gems
+    cp -a /usr/share/jruby/lib/ruby/gems/shared/* /tmp/jruby_gems
+       for gem in diff-lcs minitest power_assert rake rspec rspec-core 
rspec-expectations rspec-mocks rspec-support test-unit; do
+               # some gems are copied from libruby*, others from local rubygems
+               if test -e /usr/lib/ruby/gems/*/gems/${gem}-*; then
+                       gembase="/usr/lib/ruby/gems/*"
+               else
+                       gembase=/usr/share/rubygems-integration/all
+               fi
+               echo "installing ${gem} gem into jruby ..."
+               cp -a ${gembase}/gems/${gem}-* /tmp/jruby_gems/gems
+               cp -a ${gembase}/specifications/${gem}-* 
/tmp/jruby_gems/specifications
+       done
+    export GEM_HOME=/tmp/jruby_gems
+
+    # copy/fixup the rake binary
+    cp /usr/bin/rake ./bin
+    sed -i '1s|^#!.*|#!/usr/bin/jruby|' ./bin/rake
 }
 
 # run 1 test at a time and output test names


=====================================
debian/tests/control
=====================================
@@ -2,7 +2,15 @@ Tests: smoke
 Restrictions: superficial
 
 Tests: jgem
-Restrictions: allow-stderr, needs-internet
+Depends:
+ rake,
+ ruby-diff-lcs,
+ ruby-minitest,
+ ruby-power-assert,
+ ruby-rspec,
+ ruby-test-unit,
+ @,
+Restrictions: needs-internet
 
 Tests: jirb
 Depends:


=====================================
debian/tests/jgem
=====================================
@@ -1,20 +1,20 @@
 #!/bin/sh
 
-# Test jgem functionality
+. "$(dirname $0)/common.sh"
+
+prepare
 
-set -e
+cd "$AUTOPKGTEST_TMP"
+
+# Test jgem functionality
 
 # check if default local gems exist
 # (specific gem not important)
 jgem list | grep '^json'
 
-# prepare a writable GEM_HOME
-mkdir -p /tmp/jruby/gems /tmp/jruby/bin
-export JRUBY_OPTS="-J-Djruby.gem.home=/tmp/jruby/gems 
-J-Djruby.bindir=/tmp/jruby/bin"
-
 # check if we can install a new gem
-jgem install rake
-jgem list | grep -q "^rake ([0-9\.]\+)"
+jgem install --bindir ./bin trocla
+jgem list | grep -q "^trocla ([0-9\.]\+)"
 
 # invoke the new gem's binary
-jruby -S rake --version
+jruby -S trocla --version



View it on GitLab: 
https://salsa.debian.org/java-team/jruby/-/commit/942c924416e2eb7c9e652cdbc9a482798ccd2e46

-- 
View it on GitLab: 
https://salsa.debian.org/java-team/jruby/-/commit/942c924416e2eb7c9e652cdbc9a482798ccd2e46
You're receiving this email because of your account on salsa.debian.org.


_______________________________________________
pkg-java-commits mailing list
pkg-java-comm...@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to