This also uses symlinks for test and bench directory from the LuaJIT-test-cleanup repository.
157 lines
5.2 KiB
Diff
157 lines
5.2 KiB
Diff
From fdd83775c8e0e6a4e0ffd30dacd0b841bd243820 Mon Sep 17 00:00:00 2001
|
|
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
Date: Thu, 21 Oct 2021 11:04:58 +0200
|
|
Subject: [PATCH] Update Makefile to run LuaJIT-test-cleanup
|
|
|
|
The tests and benchmarks in the LuaJIT-test-cleanup repo are more or
|
|
less complete and with scaffolding added, they can now be called
|
|
seamlessly from within the luajit sources using `make check` and `make
|
|
bench` respectively.
|
|
---
|
|
Makefile | 17 ++++++++++++---
|
|
bench/Makefile | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
2 files changed, 70 insertions(+), 3 deletions(-)
|
|
create mode 100644 bench/Makefile
|
|
|
|
Index: LuaJIT-2.1/Makefile
|
|
===================================================================
|
|
--- LuaJIT-2.1.orig/Makefile 2023-08-29 08:35:57.939200606 +0200
|
|
+++ LuaJIT-2.1/Makefile 2023-08-29 08:40:59.284925468 +0200
|
|
@@ -118,14 +118,14 @@ endif
|
|
|
|
##############################################################################
|
|
|
|
-INSTALL_DEP= src/luajit
|
|
+LUAJIT_BIN= src/luajit
|
|
|
|
default all $(INSTALL_DEP):
|
|
@echo "==== Building LuaJIT $(MMVERSION) ===="
|
|
$(MAKE) -C src
|
|
@echo "==== Successfully built LuaJIT $(MMVERSION) ===="
|
|
|
|
-install: $(INSTALL_DEP)
|
|
+install: $(LUAJIT_BIN)
|
|
@echo "==== Installing LuaJIT $(VERSION) to $(PREFIX) ===="
|
|
$(MKDIR) $(INSTALL_DIRS)
|
|
cd src && $(INSTALL_X) $(FILE_T) $(INSTALL_T)
|
|
@@ -158,6 +158,17 @@ uninstall:
|
|
$(RMDIR) $(UNINSTALL_DIRS) || :
|
|
@echo "==== Successfully uninstalled LuaJIT $(VERSION) from $(PREFIX) ===="
|
|
|
|
+check: $(LUAJIT_BIN)
|
|
+ @echo "==== Running tests for LuaJIT $(VERSION) ===="
|
|
+ $^ test/test.lua
|
|
+ @echo "==== All tests for LuaJIT $(VERSION) succeeded ===="
|
|
+
|
|
+# It is assumed that libluajit.a is built in the process of building LUAJIT_BIN.
|
|
+bench: $(LUAJIT_BIN)
|
|
+ @echo "==== Running benchmark for LuaJIT $(VERSION) ===="
|
|
+ make -C bench FILE_A=$(FILE_A)
|
|
+ @echo "==== Successfully finished running benchmark for LuaJIT $(VERSION) ===="
|
|
+
|
|
##############################################################################
|
|
|
|
amalg:
|
|
@@ -168,6 +179,6 @@ amalg:
|
|
clean:
|
|
$(MAKE) -C src clean
|
|
|
|
-.PHONY: all install amalg clean
|
|
+.PHONY: all install amalg clean bench check
|
|
|
|
##############################################################################
|
|
Index: LuaJIT-2.1/bench/Makefile
|
|
===================================================================
|
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
+++ LuaJIT-2.1/bench/Makefile 2023-08-29 08:36:28.443172755 +0200
|
|
@@ -0,0 +1,56 @@
|
|
+CC=gcc
|
|
+
|
|
+LUA_FILE_ARG = -a
|
|
+LUA_ARG = $(patsubst %.lua,%,$^)
|
|
+
|
|
+ifndef LUA_BIN
|
|
+BENCH_BIN = luajit-bench
|
|
+LUA_BIN_NAME = ./$(BENCH_BIN)
|
|
+else
|
|
+ifdef BENCH_DURATION
|
|
+BENCH_ARG = -t $(BENCH_DURATION)
|
|
+endif
|
|
+LUA_BIN_NAME = $(LUA_BIN) luajit-bench.lua $(BENCH_ARG)
|
|
+endif
|
|
+
|
|
+BENCHMARKS = array3d binary-trees chameneos coroutine-ring euler14-bit \
|
|
+ fannkuch fasta k-nucleotide life mandelbrot mandelbrot-bit md5 \
|
|
+ meteor nbody nsieve nsieve-bit nsieve-bit-fp partialsums \
|
|
+ pidigits-nogmp ray recursive-ack recursive-fib revcomp \
|
|
+ scimark-2010-12-20 scimark-fft scimark-lu series scimark-sparse \
|
|
+ scimark-sor spectral-norm sum-file
|
|
+
|
|
+# Specify benchmarks that need input files.
|
|
+INPUT-k-nucleotide = FASTA_1000000
|
|
+INPUT-revcomp = FASTA_1000000
|
|
+INPUT-sum-file = SUMCOL_1000
|
|
+
|
|
+input-file = $(INPUT-$(patsubst %.result,%,$@))
|
|
+input-file-arg = $(if $(input-file),$(LUA_FILE_ARG) $(input-file),)
|
|
+LUA_CMD = $(LUA_BIN_NAME) $(LUA_ARG) $(input-file-arg)
|
|
+
|
|
+bench_targets = $(patsubst %,%.result,$(BENCHMARKS))
|
|
+
|
|
+all: $(BENCH_BIN) $(bench_targets)
|
|
+
|
|
+%.result: %.lua
|
|
+ @$(LUA_CMD)
|
|
+
|
|
+ifndef LUA_BIN
|
|
+ifdef BENCH_DURATION
|
|
+DURATION = -DBENCH_DURATION=$(BENCH_DURATION)
|
|
+endif
|
|
+
|
|
+LUAJIT_A = ../src/$(FILE_A)
|
|
+
|
|
+$(BENCH_BIN): $(LUAJIT_A) $(BENCH_BIN).c Makefile
|
|
+ $(CC) $@.c -std=gnu11 $(DURATION) -g -O3 -c -o $@.o -I ../src
|
|
+ $(CC) $@.o -lpthread $< -lm -ldl -o $@
|
|
+
|
|
+# Build the luajit static library if it doesn't exist.
|
|
+$(LUAJIT_A):
|
|
+ make -C ..
|
|
+
|
|
+clean:
|
|
+ rm -f $(BENCH_BIN) main.o
|
|
+endif
|
|
Index: LuaJIT-2.1/LuaJIT-test-cleanup-master/test/lib/contents.lua
|
|
===================================================================
|
|
--- LuaJIT-2.1.orig/LuaJIT-test-cleanup-master/test/lib/contents.lua 2016-10-19 23:27:03.000000000 +0200
|
|
+++ LuaJIT-2.1/LuaJIT-test-cleanup-master/test/lib/contents.lua 2023-08-29 08:36:28.444172754 +0200
|
|
@@ -76,8 +76,9 @@ do --- 5.2 string +lua>=5.2
|
|
assert(not string.gfind)
|
|
end
|
|
|
|
+-- Adapted for latest changes
|
|
do --- pre-5.2 table +lua<5.2
|
|
- check(table, "concat:foreach:foreachi:getn:insert:maxn:remove:sort", "pack:unpack:setn:new")
|
|
+ check(table, "concat:foreach:foreachi:getn:insert:maxn:move:remove:sort", "pack:unpack:setn:new")
|
|
end
|
|
|
|
do --- 5.2 table +lua>=5.2
|
|
@@ -118,10 +119,17 @@ end
|
|
|
|
do --- pre-5.2 package +lua<5.2
|
|
assert(package.loaders)
|
|
- assert(not package.searchers)
|
|
assert(package.seeall)
|
|
end
|
|
|
|
+-- LuaJIT version check for lua will return true for +lua<5.2 since it
|
|
+-- does not fully implement 5.2. Move the (not package.searchers) check
|
|
+-- to +compat5.2 instead of the version check since it is implemented by
|
|
+-- compat5.2.
|
|
+do --- 5.2 compat package +compat5.2
|
|
+ assert(package.searchers)
|
|
+end
|
|
+
|
|
do --- 5.2 package +lua>=5.2
|
|
assert(not package.loaders)
|
|
assert(package.searchers)
|