Skip to content

Commit

Permalink
[51_5] Run Scheme Tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
da-liii authored Oct 19, 2023
1 parent c45778b commit e1f5372
Show file tree
Hide file tree
Showing 18 changed files with 179 additions and 146 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci-xmake-archlinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ jobs:
- name: Build
run: xmake build --yes -vD research && xmake build --yes -vD --group=tests

- name: test
- name: C++ tests
run: xmake run --yes -vD --group=tests

- name: Scheme tests
run: xmake run --yes -vD --group=scheme_tests

- name: integration test
run: xmake run --yes -vD --group=integration_tests
4 changes: 3 additions & 1 deletion .github/workflows/ci-xmake-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ jobs:
run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg --yes
- name: build
run: xmake build --yes -vD research && xmake build --yes -vD --group=tests
- name: test
- name: C++ tests
run: xmake run --yes --verbose --diagnosis --group=tests
env:
QT_QPA_PLATFORM: offscreen
- name: Scheme tests
run: xmake run --yes -vD --group=scheme_tests
- name: integration test
run: xmake run --yes -vD --group=integration_tests
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-xmake-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ jobs:
- name: install
run: |
xmake install research
- name: Scheme tests
run: xmake run --yes -vD --group=scheme_tests
- name: integration test in scheme
run: xmake run --yes -vD --group=integration_tests
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-xmake-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ jobs:
env:
QT_QPA_PLATFORM: offscreen
INSTALL_DIR: ${{ runner.workspace }}/build/packages/app.mogan/
- name: Scheme tests
run: xmake run --yes -vD --group=scheme_tests
- name: integration test
run: xmake run --yes -vD --group=integration_tests
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-xmake-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ jobs:
- name: install
run: |
xmake install research
- name: Scheme tests
run: xmake run --yes -vD --group=scheme_tests
- name: integration test in scheme
run: xmake run --yes -vD --group=integration_tests
env:
Expand Down
File renamed without changes.
18 changes: 0 additions & 18 deletions TeXmacs/progs/check/check-master.scm
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,3 @@

(tm-define (run-checks)
(check-latex-export "$TEXMACS_CHECKS/latex-export"))

(tm-define (run-all-tests)
(regtest-htmltm)
(regtest-xmltm)
(regtest-tmlength)
(regtest-environment)
(regtest-mathtm)
(regtest-tmhtml)
(regtest-tmmltm)
(regtest-prog-format)
(regtest-tm-define)
(regtest-tm-modes)
(regtest-tm-dialogue)
(regtest-fonts)
(regtest-tm-tools)
(regtest-graphics-group)
(regtest-cite-sort)
)
6 changes: 2 additions & 4 deletions TeXmacs/progs/init-code.scm
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@
(inherit-modules (kernel gui gui-markup)
(kernel gui menu-define) (kernel gui menu-widget)
(kernel gui kbd-define) (kernel gui kbd-handlers)
(kernel gui menu-test)
(kernel old-gui old-gui-widget)
(kernel old-gui old-gui-factory)
(kernel old-gui old-gui-form)
(kernel old-gui old-gui-test))
(kernel old-gui old-gui-form))
;;(display* "time: " (- (texmacs-time) boot-start) "\n")
;;(display* "memory: " (texmacs-memory) " bytes\n")

Expand Down Expand Up @@ -432,7 +430,7 @@
;;(display* "memory: " (texmacs-memory) " bytes\n")

;;(display "Booting regression testing\n")
(lazy-define (check check-master) check-all run-checks run-all-tests)
(lazy-define (check check-master) check-all run-checks)
;;(display* "time: " (- (texmacs-time) boot-start) "\n")
;;(display* "memory: " (texmacs-memory) " bytes\n")

Expand Down
6 changes: 2 additions & 4 deletions TeXmacs/progs/init-draw.scm
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@
(inherit-modules (kernel gui gui-markup)
(kernel gui menu-define) (kernel gui menu-widget)
(kernel gui kbd-define) (kernel gui kbd-handlers)
(kernel gui menu-test)
(kernel old-gui old-gui-widget)
(kernel old-gui old-gui-factory)
(kernel old-gui old-gui-form)
(kernel old-gui old-gui-test))
(kernel old-gui old-gui-form))
;;(display* "time: " (- (texmacs-time) boot-start) "\n")
;;(display* "memory: " (texmacs-memory) " bytes\n")

Expand Down Expand Up @@ -452,7 +450,7 @@
;;(display* "memory: " (texmacs-memory) " bytes\n")

;;(display "Booting regression testing\n")
(lazy-define (check check-master) check-all run-checks run-all-tests)
(lazy-define (check check-master) check-all run-checks)
;;(display* "time: " (- (texmacs-time) boot-start) "\n")
;;(display* "memory: " (texmacs-memory) " bytes\n")

Expand Down
66 changes: 32 additions & 34 deletions TeXmacs/progs/init-research.scm
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@
)


(let ()
(display "Benchmark 1\n")
(define start (texmacs-time))
(define (fib n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))
(display (fib 30))
(newline)
(display "Time: ") (display (- (texmacs-time) start)) (newline)
)
;; (let ()
;; (display "Benchmark 1\n")
;; (define start (texmacs-time))
;; (define (fib n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))
;; (display (fib 30))
;; (newline)
;; (display "Time: ") (display (- (texmacs-time) start)) (newline)
;; )

(define developer-mode? #f)
(define boot-start (texmacs-time))
(define remote-client-list (list))

(display "Booting TeXmacs kernel functionality\n")
;; (display "Booting TeXmacs kernel functionality\n")
(load (url-concretize "$TEXMACS_PATH/progs/kernel/boot/boot-s7.scm"))

(inherit-modules (kernel boot compat-s7) (kernel boot abbrevs)
Expand All @@ -79,11 +79,9 @@
(inherit-modules (kernel gui gui-markup)
(kernel gui menu-define) (kernel gui menu-widget)
(kernel gui kbd-define) (kernel gui kbd-handlers)
(kernel gui menu-test)
(kernel old-gui old-gui-widget)
(kernel old-gui old-gui-factory)
(kernel old-gui old-gui-form)
(kernel old-gui old-gui-test))
(kernel old-gui old-gui-form))
;;(display* "time: " (- (texmacs-time) boot-start) "\n")
;;(display* "memory: " (texmacs-memory) " bytes\n")

Expand Down Expand Up @@ -452,40 +450,40 @@
;;(display* "memory: " (texmacs-memory) " bytes\n")

;;(display "Booting regression testing\n")
(lazy-define (check check-master) check-all run-checks run-all-tests)
(lazy-define (check check-master) check-all run-checks)
;;(display* "time: " (- (texmacs-time) boot-start) "\n")
;;(display* "memory: " (texmacs-memory) " bytes\n")

;;(display "Booting autoupdater\n")
(when (use-plugin-updater?)
(use-modules (utils misc updater))
(delayed (:idle 2000) (updater-initialize)))
(display* "time: " (- (texmacs-time) boot-start) "\n")
(display* "memory: " (texmacs-memory) " bytes\n")
;; (display* "time: " (- (texmacs-time) boot-start) "\n")
;; (display* "memory: " (texmacs-memory) " bytes\n")

(display "------------------------------------------------------\n")
;; (display "------------------------------------------------------\n")
(delayed (:idle 10000) (autosave-delayed))
(texmacs-banner)
(display "Initialization done\n")

(let ()
(display "------------------------------------------------------\n")
(display "Benchmark 2\n")
(define start (texmacs-time))
(tm-define (tm-fib n) (if (< n 2) n (+ (tm-fib (- n 1)) (tm-fib (- n 2)))))
(display (tm-fib 30))
(newline)
(display "Time: ") (display (- (texmacs-time) start)) (newline)
(display "------------------------------------------------------\n")
)

(display "------------------------------------------------------\n")
(display "Forcing delayed loads\n")
;; (display "Initialization done\n")

;; (let ()
;; (display "------------------------------------------------------\n")
;; (display "Benchmark 2\n")
;; (define start (texmacs-time))
;; (tm-define (tm-fib n) (if (< n 2) n (+ (tm-fib (- n 1)) (tm-fib (- n 2)))))
;; (display (tm-fib 30))
;; (newline)
;; (display "Time: ") (display (- (texmacs-time) start)) (newline)
;; (display "------------------------------------------------------\n")
;; )

;; (display "------------------------------------------------------\n")
;; (display "Forcing delayed loads\n")

(lazy-keyboard-force #t)
(display* "time: " (- (texmacs-time) boot-start) "\n")
(display* "memory: " (texmacs-memory) " bytes\n")
(display "------------------------------------------------------\n")
;; (display* "time: " (- (texmacs-time) boot-start) "\n")
;; (display* "memory: " (texmacs-memory) " bytes\n")
;; (display "------------------------------------------------------\n")



Expand Down
6 changes: 2 additions & 4 deletions TeXmacs/progs/init-tm2html.scm
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@
(inherit-modules (kernel gui gui-markup)
(kernel gui menu-define) (kernel gui menu-widget)
(kernel gui kbd-define) (kernel gui kbd-handlers)
(kernel gui menu-test)
(kernel old-gui old-gui-widget)
(kernel old-gui old-gui-factory)
(kernel old-gui old-gui-form)
(kernel old-gui old-gui-test))
(kernel old-gui old-gui-form))
;;(display* "time: " (- (texmacs-time) boot-start) "\n")
;;(display* "memory: " (texmacs-memory) " bytes\n")

Expand Down Expand Up @@ -431,7 +429,7 @@
;;(display* "memory: " (texmacs-memory) " bytes\n")

;;(display "Booting regression testing\n")
(lazy-define (check check-master) check-all run-checks run-all-tests)
(lazy-define (check check-master) check-all run-checks)
;;(display* "time: " (- (texmacs-time) boot-start) "\n")
;;(display* "memory: " (texmacs-memory) " bytes\n")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; MODULE : menu-test.scm
;; MODULE : menu-demo.scm
;; DESCRIPTION : some test widgets
;; COPYRIGHT : (C) 2012 Joris van der Hoeven
;;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(texmacs-module (kernel old-gui old-gui-test))
(texmacs-module (kernel old-gui old-gui-demo))

(tm-define (open-test-widget)
;; NOTE: close with Done in order to test other widgets
Expand Down
File renamed without changes.
87 changes: 9 additions & 78 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -571,99 +571,30 @@ target("windows_installer") do
end)
end

function add_test_target (filepath, dep)
local testname = path.basename(filepath)
target(testname) do
set_enabled(not is_plat("wasm"))
add_runenvs("TEXMACS_PATH", path.join(os.projectdir(), "TeXmacs"))
set_group("tests")
add_deps(dep)
set_languages("c++17")
set_policy("check.auto_ignore_flags", false)
if is_plat("windows") then
set_encodings("utf-8") -- eliminate warning C4819 on msvc
add_ldflags("/LTCG")
end
if is_plat("windows", "mingw") then
add_syslinks("secur32")
end
add_rules("qt.console")
add_frameworks("QtGui", "QtWidgets", "QtCore", "QtPrintSupport", "QtSvg", "QtTest")
if not is_plat("windows") then
add_syslinks("pthread")
end
if is_plat ("mingw") then
add_packages("mingw-w64")
end
add_packages("s7")
add_packages("lolly")

add_includedirs({"$(buildir)", "tests/Base"})
add_includedirs(libmogan_headers)
build_glue_on_config()
add_files("tests/Base/base.cpp")
add_files(filepath)
add_files(filepath, {rules = "qt.moc"})
before_build(function (target)
target:add("forceincludes", path.absolute("$(buildir)/config.h"))
end)

if is_plat("wasm") then
on_run(function (target)
node = os.getenv("EMSDK_NODE")
cmd = node .. " $(buildir)/wasm/wasm32/$(mode)/" .. testname .. ".js"
print("> " .. cmd)
os.exec(cmd)
end)
end
end
end

includes("xmake/tests.lua")
-- Tests in C++
l3_cpp_tests = os.files("tests/L3/**_test.cpp")
all_cpp_tests = os.files("tests/**_test.cpp")

for _, filepath in ipairs(l3_cpp_tests) do
add_test_target (filepath, "libkernel_l3")
add_target_cpp_test(filepath, "libkernel_l3")
end

for _, filepath in ipairs(all_cpp_tests) do
if not table.contains(l3_cpp_tests, filepath) then
add_test_target (filepath, "libmogan")
add_target_cpp_test(filepath, "libmogan")
end
end

-- Tests in Scheme
for _, filepath in ipairs(os.files("TeXmacs/progs/**/*-test.scm")) do
add_target_scheme_test(filepath, INSTALL_DIR, RUN_ENVS)
end

-- Integration tests
for _, filepath in ipairs(os.files("TeXmacs/tests/*.scm")) do
local testname = path.basename(filepath)
target(testname) do
set_enabled(not is_plat("wasm"))
set_kind("phony")
set_group("integration_tests")
add_deps("research")
on_run(function (target)
name = target:name()
params = {
"-headless",
"-b", path.join("TeXmacs","tests",name..".scm"),
"-x", "(test_"..name..")",
"-q"
}
if is_plat("macosx", "linux") then
binary = target:deps()["research"]:targetfile()
elseif is_plat("mingw", "windows") then
binary = path.join(INSTALL_DIR,"bin","MGResearch.exe")
else
print("Unsupported plat $(plat)")
end
cmd = binary
if is_plat("macosx", "linux") then
os.execv(cmd, params, {envs=RUN_ENVS})
else
os.execv(cmd, params)
end
end)
end
add_target_integration_test(filepath, INSTALL_DIR, RUN_ENVS)
end


Expand Down
Loading

0 comments on commit e1f5372

Please sign in to comment.