#!/bin/sh

. "$(dirname $0)/common.sh"

prepare
install_gem_bundle
debug_tests

cd "$AUTOPKGTEST_TMP"

# exclude failing tests

# Unreliable tests relying on bespoke threading
# see https://github.com/jruby/jruby/issues/8118
mri_exclude test_validation_failure TestOpenURISSL.rb

# Frequent timeout in salsa autopkgtest
mri_exclude test_interrupt_in_other_thread TestRelineAsReadline.rb

# these tests fail for unknown reason
mri_exclude test_frozen_string_literal TestERBCore.rb
mri_exclude test_frozen_string_literal TestERBCoreWOStrScan.rb

# skip test case requiring bouncycastle >= 1.84
mri_exclude test_tbs_precert_bytes OpenSSL/TestX509Certificate.rb

# skip failing tests on specific architectures
if [ "$(dpkg-architecture -qDEB_BUILD_ARCH)" = "arm64" ]; then
    mri_exclude test_failed_path TestIO_Console.rb
fi

# drop unreliable tests
# https://github.com/jruby/jruby/issues/9614
rm test/mri/net/http/test_http.rb

# run the testsuite
jruby -S rake test:mri:stdlib
