summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Vyalkova <cyber+gentoo@sysrq.in>2022-11-26 18:38:40 +0500
committerMaciej Barć <xgqt@gentoo.org>2023-01-11 04:44:06 +0100
commit88d533201c2b782f3abb14812215fb8b3da7cd12 (patch)
treee04e79a4fdda61ef45065162cf03079056464ace /dev-lang/nim
parentsec-keys/openpgp-keys-apache-tomcat: Stabilize 10.1.4 arm64, #890359 (diff)
downloadgentoo-88d533201c2b782f3abb14812215fb8b3da7cd12.tar.gz
gentoo-88d533201c2b782f3abb14812215fb8b3da7cd12.tar.bz2
gentoo-88d533201c2b782f3abb14812215fb8b3da7cd12.zip
dev-lang/nim: enable tests
Some categories are skipped: * arc, valgrind: need function valgrind * ic: random failures Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in> Closes: https://github.com/gentoo/gentoo/pull/29006 Signed-off-by: Maciej Barć <xgqt@gentoo.org>
Diffstat (limited to 'dev-lang/nim')
-rw-r--r--dev-lang/nim/files/nim-1.6.10-testament-skipfile.txt40
-rw-r--r--dev-lang/nim/metadata.xml1
-rw-r--r--dev-lang/nim/nim-1.6.10-r2.ebuild67
3 files changed, 104 insertions, 4 deletions
diff --git a/dev-lang/nim/files/nim-1.6.10-testament-skipfile.txt b/dev-lang/nim/files/nim-1.6.10-testament-skipfile.txt
new file mode 100644
index 000000000000..46d22c9fe915
--- /dev/null
+++ b/dev-lang/nim/files/nim-1.6.10-testament-skipfile.txt
@@ -0,0 +1,40 @@
+# broken
+tests/assert/tassert_c.nim
+tests/async/tasync_traceback.nim
+tests/errmsgs/tcall_with_default_arg.nim
+tests/errmsgs/tproper_stacktrace.nim
+tests/errmsgs/tproper_stacktrace2.nim
+tests/errmsgs/tproper_stacktrace3.nim
+tests/js/tmangle.nim
+tests/js/twritestacktrace.nim
+tests/lent/tbasic_lent_check.nim
+tests/misc/trunner.nim
+tests/misc/tstrace.nim
+tests/pragmas/thintprocessing.nim
+tests/pragmas/tused.nim
+tests/pragmas/twarning_off.nim
+tests/stdlib/tos.nim
+tests/stdlib/tstackframes.nim
+tests/stdlib/tstats.nim
+tests/system/talloc.nim
+tests/testament/tshould_not_work.nim
+# require network
+tests/stdlib/thttpclient.nim
+tests/stdlib/tnetconnect.nim
+tests/stdlib/tssl.nim
+# don't work without megatest
+tests/misc/tjoinable.nim
+tests/testament/tjoinable.nim
+# don't work with "--hint:all:off" hack
+tests/concepts/t3330.nim
+tests/stylecheck/t20397_2.nim
+tests/stylecheck/treject.nim
+tests/stylecheck/tusages.nim
+# need external dependencies
+tests/manyloc/keineschweine/keineschweine.nim
+tests/manyloc/nake/nakefile.nim
+tests/niminaction/Chapter7/Tweeter/src/tweeter.nim
+# need functional valgrind
+tests/destructor/tnewruntime_strutils.nim
+tests/destructor/tv2_raise.nim
+tests/views/tsplit_into_openarray.nim
diff --git a/dev-lang/nim/metadata.xml b/dev-lang/nim/metadata.xml
index d24270e82fb6..b544028faf59 100644
--- a/dev-lang/nim/metadata.xml
+++ b/dev-lang/nim/metadata.xml
@@ -38,5 +38,6 @@
</upstream>
<use>
<flag name="experimental">Apply experimental patches</flag>
+ <flag name="test-js">Enable tests that require Node.js</flag>
</use>
</pkgmetadata>
diff --git a/dev-lang/nim/nim-1.6.10-r2.ebuild b/dev-lang/nim/nim-1.6.10-r2.ebuild
index 5140ee232527..5bbd9b8328f5 100644
--- a/dev-lang/nim/nim-1.6.10-r2.ebuild
+++ b/dev-lang/nim/nim-1.6.10-r2.ebuild
@@ -19,10 +19,29 @@ SRC_URI="
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
-IUSE="doc experimental"
-RESTRICT="test" # need to sort out depends and numerous failures
+IUSE="doc experimental test-js test"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+ test? (
+ dev-db/sqlite:3
+ dev-libs/boehm-gc
+ dev-libs/libffi
+ dev-libs/libpcre:3
+ dev-libs/openssl
+ media-libs/libsdl
+ media-libs/libsfml
+ )
+"
-BDEPEND="sys-process/parallel"
+BDEPEND="
+ sys-process/parallel
+ test? (
+ test-js? (
+ net-libs/nodejs
+ )
+ )
+"
PATCHES=(
"${FILESDIR}"/${PN}-0.20.0-paths.patch
@@ -51,6 +70,9 @@ nim_gen_config() {
$([[ "${NOCOLOR}" == true || "${NOCOLOR}" == yes ]] && echo '--colors:"off"')
-d:"release"
--parallelBuild:"$(makeopts_jobs)"
+
+ # some tests don't work with processing hints
+ --processing:"off"
EOF
}
@@ -105,8 +127,45 @@ src_compile() {
src_test() {
local -x PATH="${S}/bin:${PATH}"
+ local nimflags=(
+ # Leave only the safe hints enabled
+ --hint:all:off
+ --hint:User:on
+ --hint:UserRaw:on
+ )
+ local testament_args=(
+ --skipFrom:"${FILESDIR}/${P}-testament-skipfile.txt"
+ --nim:"bin/nim"
+ --targets:"$(usex test-js 'c js' 'c')"
+ )
+
+ [[ "${NOCOLOR}" == true || "${NOCOLOR}" == yes ]] && \
+ testament_args+=( --colors:off )
+
+ local -a categories
+ readarray -t categories < <(find tests -mindepth 1 -maxdepth 1 -type d -printf "%P\n" | sort)
+
+ # AdditionalCategories from "testament/categories.nim"
+ categories+=( debugger examples lib )
- edo ./koch test
+ local tcat checkpoint
+ for tcat in "${categories[@]}"; do
+ # Use checkpoints for less painful testing
+ checkpoint="${T}/.testament-${tcat}"
+ [[ -f "${checkpoint}" ]] && continue
+
+ case ${tcat} in
+ testdata) ;;
+ arc|ic|valgrind)
+ einfo "Skipped category '${tcat}'" ;;
+ *)
+ einfo "Running tests in category '${tcat}'"
+ edo ./bin/testament "${testament_args[@]}" \
+ category "${tcat}" "${nimflags[@]}"
+ esac
+
+ touch "${checkpoint}" || die
+ done
}
src_install() {