File: common.sh

package info (click to toggle)
jruby 9.3.9.0%2Bds-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,856 kB
  • sloc: ruby: 517,823; java: 260,094; xml: 31,930; ansic: 5,777; yacc: 4,973; sh: 1,163; makefile: 105; jsp: 48; tcl: 40; exp: 11
file content (44 lines) | stat: -rw-r--r-- 1,547 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
set -e

# prepare test environment
prepare() {
    cp -a default.build.properties Gemfile Rakefile rakelib spec test "$AUTOPKGTEST_TMP"
    cp -a /usr/share/jruby/bin "$AUTOPKGTEST_TMP/bin"
    ln -s /usr/share/jruby/lib "$AUTOPKGTEST_TMP/lib"
    export LANG=C.UTF-8
    export LC_ALL=C.UTF-8
    export CI=1
    export JOBS=2

    # 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
# so we can more easily catch hanging tests
debug_tests() {
    export JOBS=1
    # modifies ADDITIONAL_TEST_OPTIONS
    sed -i 's/--tty=no/-v/' "$AUTOPKGTEST_TMP/rakelib/test.rake"
    # modifies TESTOPT
    sed -i 's/--no-use-color/--no-use-color -v/' "$AUTOPKGTEST_TMP/rakelib/test.rake"
}