diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-12 21:51:54 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-12 22:23:07 +0200 |
commit | 04170b314686f4117edf1052d5ef951f570de158 (patch) | |
tree | bf6c3c1cfea640230914543366313a66488a0dd8 | |
parent | 1f89c5f7ea9a5188e5d6a5352ae1fd6bf74fa8d5 (diff) | |
download | aports-04170b314686f4117edf1052d5ef951f570de158.tar.bz2 aports-04170b314686f4117edf1052d5ef951f570de158.tar.xz |
community/lua-lpeg: run tests on check
-rw-r--r-- | community/lua-lpeg/APKBUILD | 23 | ||||
-rw-r--r-- | community/lua-lpeg/test-fix-setlocale.patch | 20 |
2 files changed, 40 insertions, 3 deletions
diff --git a/community/lua-lpeg/APKBUILD b/community/lua-lpeg/APKBUILD index afd28a4579..b1ca9b5e34 100644 --- a/community/lua-lpeg/APKBUILD +++ b/community/lua-lpeg/APKBUILD @@ -3,7 +3,7 @@ pkgname=lua-lpeg _pkgname=lpeg pkgver=1.0.1 -pkgrel=1 +pkgrel=2 pkgdesc="Pattern-matching library for Lua" url="http://www.inf.puc-rio.br/~roberto/lpeg" arch="all" @@ -11,9 +11,16 @@ license="MIT" depends="" makedepends="" subpackages="" -source="http://www.inf.puc-rio.br/~roberto/lpeg/$_pkgname-$pkgver.tar.gz" +source="http://www.inf.puc-rio.br/~roberto/lpeg/$_pkgname-$pkgver.tar.gz + test-fix-setlocale.patch" builddir="$srcdir/$_pkgname-$pkgver" +# luajit is not available for selected arches +case "$CARCH" in + s390x) _luajit="";; + *) checkdepends="luajit" _luajit="jit";; +esac + _luaversions="5.1 5.2 5.3" for _v in $_luaversions; do makedepends="$makedepends lua$_v-dev" @@ -41,6 +48,15 @@ build() { done } +check() { + local lver; for lver in $_luaversions $_luajit; do + msg "Testing on lua$lver" + + cd "$builddir-${lver/jit/5.1}" + lua$lver test.lua + done +} + package() { mkdir -p "$pkgdir" } @@ -59,4 +75,5 @@ _package() { "$subpkgdir"/usr/share/lua/$lver/re.lua || return 1 } -sha512sums="7b43fbee7eff443000986684bc56bba6d2796a31cf860740746c70e155bdea1b62a46b93f97e2747e3ef0f63e965148778ac2985d0f2d83e1e37ec4ebbabf4aa lpeg-1.0.1.tar.gz" +sha512sums="7b43fbee7eff443000986684bc56bba6d2796a31cf860740746c70e155bdea1b62a46b93f97e2747e3ef0f63e965148778ac2985d0f2d83e1e37ec4ebbabf4aa lpeg-1.0.1.tar.gz +49ce012e6c2f6e07b3aae4f52630f3b4aa43f936f76dbfb2b8e33208fb05aec54e2e6c815215d606ee0dfc860b07917a042c77cdc0ea5b6b14a8028fa0e724f8 test-fix-setlocale.patch" diff --git a/community/lua-lpeg/test-fix-setlocale.patch b/community/lua-lpeg/test-fix-setlocale.patch new file mode 100644 index 0000000000..028c18cf4f --- /dev/null +++ b/community/lua-lpeg/test-fix-setlocale.patch @@ -0,0 +1,20 @@ +os.setlocale just calls setlocale() from libc and musl's implementation +behaves a bit differently in comparison with BSD libc or glibc. + +When particular locales for all categories are the same, e.g. "C", +`setlocale(LC_ALL, "")` returns just "C" on BSD libc (tested on macOS) +and glibc, but musl returns "C;C;C;C;C;C". When some locale is different, +e.g. LC_CTYPE, then on macOS you get "C/en_US.UTF-8/C/C/C/C", on glibc +"LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;...", on musl "en_US.UTF-8;C;C;C;C;C". + +--- a/test.lua ++++ b/test.lua +@@ -1428,7 +1428,7 @@ + + + -- testing pre-defined names +-assert(os.setlocale("C") == "C") ++assert(os.setlocale("C"):sub(1, 1) == "C") + + function eqlpeggsub (p1, p2) + local s1 = cs2str(re.compile(p1)) |