aports/main/luajit/fix-tests-alpine.patch
Jakub Panek 689340e1c6 main/luajit: upgrade to 2.1_p20230119
Signed-off-by: Jakub Panek <me@panekj.dev>
2023-04-11 23:34:05 +02:00

89 lines
2.4 KiB
Diff

Fix tests to pass on musl and also avoid extra dependencies (e.g. ncurses, mpc, ...).
--- a/test-suite/run-tests
+++ b/test-suite/run-tests
@@ -73,15 +73,6 @@
$ENV{LUA_CPATH} = "$cwd/test/clib/?;;";
-my $cmd = "pkg-config --cflags --libs gtk+-2.0";
-my $cdefs = `$cmd`;
-if ($? != 0) {
- die "failed to run command $cmd: $?";
-}
-chomp $cdefs;
-$ENV{CDEFS} = $cdefs;
-#warn "CDEFS=$cdefs";
-
if (@ARGV) {
for my $test_file (@ARGV) {
my ($dir, $fname);
--- a/test-suite/test/ffi/ffi_redir.lua
+++ b/test-suite/test/ffi/ffi_redir.lua
@@ -12,7 +12,7 @@
]]
else
ffi.cdef[[
- int bar asm("errno");
+ int bar asm("opterr");
]]
end
--- a/test-suite/test/sysdep/ffi_include_gtk.lua
+++ b/test-suite/test/sysdep/ffi_include_gtk.lua
@@ -1,9 +0,0 @@
-local ffi = require("ffi")
-
-dofile("../common/ffi_util.inc")
-
-if cdefs == "" then
- cdefs = "-pthread -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gdk-pixbuf-2.0"
-end
-
-include"/usr/include/gtk-2.0/gtk/gtk.h"
--- a/test-suite/test/sysdep/ffi_include_std.lua
+++ b/test-suite/test/sysdep/ffi_include_std.lua
@@ -14,15 +14,8 @@
#define _Float128 long double
#include <sqlite3.h>
-#include <thread_db.h>
#include <resolv.h>
-#include <mpfr.h>
-#include <mpc.h>
-#include <curses.h>
-#include <form.h>
#include <aio.h>
-#include <unistd.h>
-#include <zlib.h>
#include <netdb.h>
#include <math.h>
#include <tgmath.h>
--- a/test-suite/test/sysdep/ffi_lib_c.lua
+++ b/test-suite/test/sysdep/ffi_lib_c.lua
@@ -7,6 +7,9 @@
int rmdir(const char *name);
int errno;
+// musl libc
+int *__errno_location(void);
+
// Windows
unsigned int GetSystemDirectoryA(char *buf, unsigned int sz);
char *CharUpperA(char *str);
@@ -62,11 +65,11 @@
ffi.C._fmode = ffi.C._O_TEXT
else
assert(ffi.C.rmdir("/tmp/does_not_exist") == -1)
- assert(ffi.C.errno == 2)
+ assert(ffi.C.__errno_location()[0] == 2)
- ffi.C.errno = 17
- assert(ffi.C.errno == 17)
- ffi.C.errno = 0
+ ffi.C.__errno_location()[0] = 17
+ assert(ffi.C.__errno_location()[0] == 17)
+ ffi.C.__errno_location()[0] = 0
end
do