Compare commits

..

107 Commits

Author SHA1 Message Date
retropikzel fd1829c9f2 dot-locking: Bug fixes 2026-08-01 08:53:32 +03:00
retropikzel 4e62182c00 Add dot-locking library 2026-07-31 14:52:24 +03:00
retropikzel 4f00dba463 Add: assert, match. Improvements: tap,debug 2026-07-27 18:53:57 +03:00
retropikzel f308245fce tap: Fix showing the version 2026-07-24 09:00:26 +03:00
retropikzel eff403988e New builds 2026-07-23 20:05:06 +03:00
retropikzel 1d26b8e142 New builds 2026-07-23 08:08:43 +03:00
retropikzel cb21096f9c New builds 2026-07-23 08:00:25 +03:00
retropikzel eb188653e6 New builds 2026-07-23 07:56:07 +03:00
retropikzel 2fe27baca0 New builds 2026-07-23 07:53:31 +03:00
retropikzel 424c235b93 New builds 2026-07-23 07:50:33 +03:00
retropikzel b3c48c03a4 New builds 2026-07-23 07:49:34 +03:00
retropikzel f8a7c7a9be New builds 2026-07-23 07:47:36 +03:00
retropikzel f3ca72f8f5 New builds 2026-07-23 07:42:06 +03:00
retropikzel 001ed29b4a New builds 2026-07-23 07:32:59 +03:00
retropikzel e88460ff17 New builds 2026-07-23 07:28:30 +03:00
retropikzel 322d4c11a1 New builds 2026-07-23 07:25:57 +03:00
retropikzel 96ad8c50c2 New builds 2026-07-23 07:20:16 +03:00
retropikzel bdac5e5d7e New builds 2026-07-23 07:06:53 +03:00
retropikzel 6589b7173d New builds 2026-07-23 06:55:55 +03:00
retropikzel 1143990d57 New builds 2026-07-23 06:54:38 +03:00
retropikzel 7efa48a886 New builds 2026-07-23 06:53:36 +03:00
retropikzel 166f918897 New builds 2026-07-23 06:50:17 +03:00
retropikzel b74bf8e8b8 New builds 2026-07-23 06:29:30 +03:00
retropikzel bb6d4f77dc New builds 2026-07-23 06:28:41 +03:00
retropikzel 5088422f9d New builds 2026-07-23 06:15:53 +03:00
retropikzel 6bf8d5989b New builds 2026-07-23 05:45:19 +03:00
retropikzel bde366aee3 New builds 2026-07-22 22:10:05 +03:00
retropikzel 6399043fa3 New builds 2026-07-22 22:09:28 +03:00
retropikzel 8cfac7fff4 New builds 2026-07-22 22:07:02 +03:00
retropikzel 1ec9630ae4 New builds 2026-07-22 22:04:30 +03:00
retropikzel 94d4915116 New builds 2026-07-22 22:01:10 +03:00
retropikzel e7d1f4b3d2 New builds 2026-07-22 22:00:39 +03:00
retropikzel 09c16e0308 New builds 2026-07-22 21:52:25 +03:00
retropikzel 667ed5242f New builds 2026-07-22 21:49:11 +03:00
retropikzel b2c362bd78 New builds 2026-07-22 21:44:47 +03:00
retropikzel a1c106fee0 New builds 2026-07-22 21:44:24 +03:00
retropikzel 0b9ede5d6e New builds 2026-07-22 21:41:53 +03:00
retropikzel 8134f64c6b New builds 2026-07-22 21:35:28 +03:00
retropikzel 8521b07a80 New builds 2026-07-22 21:34:26 +03:00
retropikzel 42c81ad668 New builds 2026-07-22 21:19:23 +03:00
retropikzel fd7e43de70 New builds 2026-07-22 21:00:34 +03:00
retropikzel adcaaa5707 New builds 2026-07-22 20:59:37 +03:00
retropikzel 35fa514296 New builds 2026-07-22 20:54:19 +03:00
retropikzel 4ed0038845 New builds 2026-07-22 20:52:49 +03:00
retropikzel b6ad713956 New builds 2026-07-22 20:50:50 +03:00
retropikzel 17f15028ba New builds 2026-07-22 20:39:21 +03:00
retropikzel a770ec9511 New builds 2026-07-22 20:36:52 +03:00
retropikzel 68c0d8294a New builds 2026-07-22 20:35:23 +03:00
retropikzel bcd01201ea New builds 2026-07-22 19:56:36 +03:00
retropikzel 396298467a New builds 2026-07-22 18:27:46 +03:00
retropikzel 79ce9e06d9 New builds 2026-07-22 18:27:24 +03:00
retropikzel 9bbb623347 New builds 2026-07-22 18:26:36 +03:00
retropikzel 1007f6437f New builds 2026-07-22 18:19:57 +03:00
retropikzel 8c838e90a8 New builds 2026-07-22 18:12:40 +03:00
retropikzel 620fba4e56 New builds 2026-07-22 18:12:07 +03:00
retropikzel 1c2c1ccd82 New builds 2026-07-22 18:11:32 +03:00
retropikzel 62084a7d39 New builds 2026-07-22 18:06:55 +03:00
retropikzel 26b3f9007c New builds 2026-07-22 18:06:27 +03:00
retropikzel d9e9ea0e90 New builds 2026-07-22 18:05:38 +03:00
retropikzel 154a1ca507 New builds 2026-07-22 18:05:10 +03:00
retropikzel 70a022e318 New builds 2026-07-22 18:03:09 +03:00
retropikzel caa087729b New builds 2026-07-22 18:02:26 +03:00
retropikzel 74f5577dfe New builds 2026-07-22 18:01:00 +03:00
retropikzel 2777cfa5b0 New builds 2026-07-22 17:55:32 +03:00
retropikzel 50cef9ac08 New builds 2026-07-22 17:55:18 +03:00
retropikzel 86a67624d2 New builds 2026-07-22 17:53:05 +03:00
retropikzel 92809b7808 New builds 2026-07-22 17:46:10 +03:00
retropikzel 0098ae98e8 New builds 2026-07-22 17:43:46 +03:00
retropikzel 71778bf94c New builds 2026-07-22 17:42:44 +03:00
retropikzel 239ff47043 New builds 2026-07-22 17:41:43 +03:00
retropikzel a049f1ff2f New builds 2026-07-22 17:41:12 +03:00
retropikzel 5c270b5d53 New builds 2026-07-22 17:39:59 +03:00
retropikzel 6d41101c61 New builds 2026-07-22 17:37:28 +03:00
retropikzel b7957cdfb9 New builds 2026-07-22 17:35:44 +03:00
retropikzel 9af7a8109a New builds 2026-07-22 17:34:05 +03:00
retropikzel 65e5b8f149 New builds 2026-07-22 17:16:21 +03:00
retropikzel 3095423e4f New builds 2026-07-22 17:10:42 +03:00
retropikzel 78a820373e New builds 2026-07-22 17:09:02 +03:00
retropikzel 0b6de16fb4 New builds 2026-07-22 17:07:19 +03:00
retropikzel 953f619558 New builds 2026-07-22 17:01:32 +03:00
retropikzel 897d8e1491 New builds 2026-07-22 17:00:06 +03:00
retropikzel af2647c669 New builds 2026-07-22 16:57:26 +03:00
retropikzel 23e1118730 New builds 2026-07-22 16:54:37 +03:00
retropikzel 64ea3b5ca5 New builds 2026-07-22 16:52:57 +03:00
retropikzel 5ca3fc468b New builds 2026-07-22 16:52:46 +03:00
retropikzel 10cd26f963 New builds 2026-07-22 16:46:10 +03:00
retropikzel 7539e2331a New builds 2026-07-22 16:44:06 +03:00
retropikzel e27df2fa97 New builds 2026-07-22 16:43:31 +03:00
retropikzel 641d8fc7fb New builds 2026-07-22 16:42:34 +03:00
retropikzel b44225a6ba New builds 2026-07-22 16:40:52 +03:00
retropikzel 4815bb4d9a New builds 2026-07-22 16:40:03 +03:00
retropikzel acd1a25e91 New builds 2026-07-22 16:38:17 +03:00
retropikzel 2f1f7e9b59 New builds 2026-07-22 16:37:09 +03:00
retropikzel b8921f60f0 New builds 2026-07-22 16:32:20 +03:00
retropikzel a248753ee2 New builds 2026-07-22 16:27:55 +03:00
retropikzel 78eb7d72fa New builds 2026-07-22 16:26:24 +03:00
retropikzel ff057418a1 New builds 2026-07-22 16:14:46 +03:00
retropikzel 0198cf9bdd New builds 2026-07-22 16:13:46 +03:00
retropikzel 1bd0978edb New builds 2026-07-22 16:12:14 +03:00
retropikzel e09497a462 New builds 2026-07-22 16:11:34 +03:00
retropikzel c82bed7137 New builds 2026-07-22 16:10:47 +03:00
retropikzel a098c35fa1 New builds 2026-07-22 16:10:04 +03:00
retropikzel b0f51011cc New builds 2026-07-22 16:08:43 +03:00
retropikzel b8b3c80ee6 New builds 2026-07-22 16:08:07 +03:00
retropikzel 4c341e74ea New builds 2026-07-22 16:07:09 +03:00
retropikzel 653ee52331 New builds 2026-07-22 16:06:24 +03:00
retropikzel 93f78aa11c New builds 2026-07-22 16:05:22 +03:00
30 changed files with 1794 additions and 121 deletions

1
.gitignore vendored
View File

@ -26,3 +26,4 @@ venv*
retropikzel/wasm/plus.sld retropikzel/wasm/plus.sld
retropikzel/*.c retropikzel/*.c
retropikzel/*.meta retropikzel/*.meta
test-program

876
Jenkinsfile vendored
View File

@ -1,80 +1,860 @@
pipeline { pipeline {
agent { agent {
dockerfile {
label 'docker-x86_64' label 'docker-x86_64'
filename 'Dockerfile.jenkins'
args '-t --user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock'
reuseNode true
} }
}
triggers {
GenericTrigger(
genericVariables: [[key: 'ref', value: '$.ref']],
causeString: 'Triggered on $ref',
printContributedVariables: true,
printPostContent: true,
silentResponse: false,
shouldNotFlatten: false,
regexpFilterText: '$ref',
regexpFilterExpression: 'refs/heads/' + BRANCH_NAME
)
}
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
} }
environment {
R6RS_SCHEMES='capyscheme chezscheme guile ikarus ironscheme loko mosh racket sagittarius ypsilon'
R7RS_SCHEMES='capyscheme chibi chicken cyclone foment gauche gambit kawa loko meevax mosh racket sagittarius skint stklos tr7 ypsilon'
LIBRARIES='tap junit debug lambda-utils ctrf mouth string url-encoding leb128 hardware-info'
}
stages { stages {
stage('Parallel') { stage('capyscheme') {
parallel { agent {
stage('R6RS tests') { docker {
image 'schemers/capyscheme:head'
reuseNode true
args '--user=root'
}
}
steps { steps {
script { script {
env.LIBRARIES.split().each { LIBRARY -> get_capyscheme_stages()
stage("${LIBRARY}") {
env.R6RS_SCHEMES.split().each { SCHEME ->
stage("${SCHEME}") {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "timeout 600 make SCHEME=${SCHEME} LIBRARY=${LIBRARY} RNRS=r6rs test-docker"
} }
} }
} }
stage('chibi') {
agent {
docker {
image 'schemers/chibi:head'
reuseNode true
args '--user=root'
} }
} }
}
}
}
stage('R7RS tests') {
steps { steps {
script { script {
env.LIBRARIES.split().each { LIBRARY -> get_chibi_stages()
stage("${LIBRARY}") {
env.R7RS_SCHEMES.split().each { SCHEME ->
stage("${SCHEME}") {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "timeout 600 make SCHEME=${SCHEME} LIBRARY=${LIBRARY} RNRS=r7rs test-docker"
} }
} }
} }
stage('chicken') {
agent {
docker {
image 'schemers/chicken:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_chicken_stages()
} }
} }
} }
stage('foment') {
agent {
docker {
image 'schemers/foment:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_foment_stages()
} }
} }
} }
stage('gauche') {
agent {
docker {
image 'schemers/gauche:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_gauche_stages()
}
}
}
stage('kawa') {
agent {
docker {
image 'schemers/kawa:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_kawa_stages()
}
}
}
stage('loko') {
agent {
docker {
image 'schemers/loko:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_loko_stages()
}
}
}
stage('meevax') {
agent {
docker {
image 'schemers/meevax:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_meevax_stages()
}
}
}
stage('mit-scheme') {
agent {
docker {
image 'schemers/mit-scheme:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_mit_scheme_stages()
}
}
}
stage('mosh') {
agent {
docker {
image 'schemers/mosh:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_mosh_stages()
}
}
}
stage('racket') {
agent {
docker {
image 'schemers/racket:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_racket_stages()
}
}
}
stage('sagittarius') {
agent {
docker {
image 'schemers/sagittarius:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_sagittarius_stages()
}
}
}
stage('skint') {
agent {
docker {
image 'schemers/skint:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_skint_stages()
}
}
}
stage('stklos') {
agent {
docker {
image 'schemers/stklos:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_stklos_stages()
}
}
}
stage('tr7') {
agent {
docker {
image 'schemers/tr7:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_tr7_stages()
}
}
}
stage('ypsilon') {
agent {
docker {
image 'schemers/ypsilon:head'
reuseNode true
args '--user=root'
}
}
steps {
script {
get_ypsilon_stages()
} }
} }
post {
always {
cleanWs()
} }
} }
} }
def get_capyscheme_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=capyscheme LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=capyscheme LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=capyscheme LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=capyscheme LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=capyscheme LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_chibi_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=chibi LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=chibi LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=chibi LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=chibi LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=chibi LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_chicken_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=chicken LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=chicken LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=chicken LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=chicken LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=chicken LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_foment_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=foment LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=foment LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=foment LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=foment LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=foment LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_gauche_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=gauche LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=gauche LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=gauche LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=gauche LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=gauche LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_kawa_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=kawa LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=kawa LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=kawa LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=kawa LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=kawa LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_loko_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=loko LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=loko LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=loko LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=loko LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=loko LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_meevax_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=meevax LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=meevax LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=meevax LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=meevax LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=meevax LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_mit_scheme_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=mit-scheme LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=mit-scheme LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=mit-scheme LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=mit-scheme LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=mit-scheme LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_mosh_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=mosh LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=mosh LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=mosh LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=mosh LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=mosh LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_racket_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=racket LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=racket LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=racket LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=racket LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=racket LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_sagittarius_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=sagittarius LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=sagittarius LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=sagittarius LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=sagittarius LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=sagittarius LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_skint_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=skint LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=skint LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=skint LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=skint LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=skint LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_stklos_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=stklos LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=stklos LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=stklos LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=stklos LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=stklos LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_tr7_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=tr7 LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=tr7 LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=tr7 LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=tr7 LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=tr7 LIBRARY=lambda-utils all install test"
}
})
return stages
}
def get_ypsilon_stages() {
def stages = []
stages.plus(stage('init') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
sh "git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
sh "make -j8 -C chibi-scheme"
sh "make -j8 -C chibi-scheme install"
sh "snow-chibi install --always-yes retropikzel.compile-r7rs"
}
})
stages.plus(stage('tap') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=ypsilon LIBRARY=tap all install test"
}
})
stages.plus(stage('mouth') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=ypsilon LIBRARY=mouth all install test"
}
})
stages.plus(stage('debug') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=ypsilon LIBRARY=debug all install test"
}
})
stages.plus(stage('hardware-info') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=ypsilon LIBRARY=hardware-info all install test"
}
})
stages.plus(stage('lambda-utils') {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "make SCHEME=ypsilon LIBRARY=lambda-utils all install test"
}
})
return stages
}

View File

@ -1,7 +1,7 @@
.SILENT: .SILENT:
SCHEME=chibi SCHEME=chibi
RNRS=r7rs RNRS=r7rs
LIBRARY=ctrf LIBRARY=tap
DOCKER_TAG=latest DOCKER_TAG=latest
AUTHOR=retropikzel AUTHOR=retropikzel
@ -12,14 +12,7 @@ LIBRARY_FILE=retropikzel/${LIBRARY}.sld
TESTFILE=retropikzel/${LIBRARY}/test.scm TESTFILE=retropikzel/${LIBRARY}/test.scm
VERSION != cat retropikzel/${LIBRARY}/VERSION VERSION != cat retropikzel/${LIBRARY}/VERSION
DESCRIPTION != head -n1 retropikzel/${LIBRARY}/README.md DESCRIPTION != head -n1 retropikzel/${LIBRARY}/README.md
README=retropikzel/${LIBRARY}/README.html DOCFILE=retropikzel/${LIBRARY}/README.html
AKKU_PACKAGES=""
SFX=scm
ifeq "${RNRS}" "r6rs"
SFX=sps
AKKU_PACKAGES="akku-r7rs"
endif
ifeq "${SCHEME}" "capyscheme" ifeq "${SCHEME}" "capyscheme"
DOCKER_TAG=head DOCKER_TAG=head
@ -39,43 +32,40 @@ endif
all: package all: package
package: retropikzel/${LIBRARY}/LICENSE retropikzel/${LIBRARY}/VERSION retropikzel/${LIBRARY}/README.md package: retropikzel/${LIBRARY}/LICENSE retropikzel/${LIBRARY}/VERSION retropikzel/${LIBRARY}/README.md
echo "<pre>$$(cat retropikzel/${LIBRARY}/README.md)</pre>" > ${README} echo "<pre>$$(cat retropikzel/${LIBRARY}/README.md)</pre>" > ${DOCFILE}
snow-chibi package \ snow-chibi package \
--always-yes \ --always-yes \
--version=${VERSION} \ --version=${VERSION} \
--authors=${AUTHOR} \ --authors=${AUTHOR} \
--doc=${README} \ --doc=${DOCFILE} \
--description="${DESCRIPTION}" \ --description="${DESCRIPTION}" \
--test=${TESTFILE} \
${LIBRARY_FILE} ${LIBRARY_FILE}
${PKG}: package ${PKG}: package
install: install: ${PKG}
snow-chibi install --impls=${SCHEME} ${PKG} snow-chibi install --impls=${SCHEME} --always-yes --install-tests?=1 --show-tests?=1 ${PKG}
testfiles: ${PKG} ${TESTFILE} test:
rm -rf ${tmpdir} COMPILE_R7RS=${SCHEME} compile-r7rs -o test-program ${TESTFILE}
mkdir -p ${tmpdir} ./test-program
cp ${PKG} ${tmpdir}
cat test-headers.${SFX} | sed 's/LIBRARY/${LIBRARY}/' > ${tmpdir}/test.${SFX}
cat ${TESTFILE} >> ${tmpdir}/test.${SFX}
test: testfiles test-docker:
cd ${tmpdir} && COMPILE_R7RS=${SCHEME} CSC_OPIONS="-L -lcurl" compile-r7rs -o test-program test.${SFX} SNOW_PACKAGES="srfi.19 srfi.64 srfi.180 retropikzel.tap ${PKG}" \
cd ${tmpdir} && ./test-program
test-docker: testfiles
SNOW_PACKAGES="srfi.19 srfi.64 srfi.180 ${PKG}" \
APT_PACKAGES="libcurl4-openssl-dev" \ APT_PACKAGES="libcurl4-openssl-dev" \
AKKU_PACKAGES="${AKKU_PACKAGES}" \ AKKU_PACKAGES="${AKKU_PACKAGES}" \
DOCKER_TAG=${DOCKER_TAG} \ DOCKER_TAG=${DOCKER_TAG} \
COMPILE_R7RS=${SCHEME} \ COMPILE_R7RS=${SCHEME} \
CSC_OPIONS="-L -lcurl" \ CSC_OPIONS="-L -lcurl" \
test-r7rs -o ${tmpdir}/test-program ${tmpdir}/test.${SFX} test-r7rs -o test-program ${TESTFILE}
retropikzel/wasm/plus.wat: retropikzel/wasm/plus.c retropikzel/wasm/plus.wat: retropikzel/wasm/plus.c
emcc -o retropikzel/wasm/plus.js retropikzel/wasm/plus.c emcc -o retropikzel/wasm/plus.js retropikzel/wasm/plus.c
wasm-dis retropikzel/wasm/plus.wasm > retropikzel/wasm/plus.wat wasm-dis retropikzel/wasm/plus.wasm > retropikzel/wasm/plus.wat
jenkinsfile: makings.scm
makings --jenkinsfile > Jenkinsfile
clean: clean:
git clean -X -f git clean -X -f

11
builds.yaml Normal file
View File

@ -0,0 +1,11 @@
- image: schemers/chibi
stages:
- name: init
cmd: |
apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev
git clone https://github.com/ashinn/chibi-scheme.git --depth=1
make -j8 -C chibi-scheme
make -j8 -C chibi-scheme install
snow-chibi install retropikzel.compile-r7rs
- name: tap
cmd: make SCHEME=chibi LIBRARY=tap all install test

35
makings.scm Normal file
View File

@ -0,0 +1,35 @@
(let ((schemes
'("capyscheme" "chibi" "chicken" "foment" "gauche" "kawa"
"loko" "meevax" "mit-scheme" "mosh" "racket" "sagittarius" "skint"
"stklos" "tr7" "ypsilon"))
(libraries
'("tap" "mouth" "debug" "hardware-info" "lambda-utils"))
(init
'("apt-get update && apt-get install -y git ca-certificates gcc make libffi-dev"
"git clone https://github.com/ashinn/chibi-scheme.git --depth=1 || true"
"make -j8 -C chibi-scheme"
"make -j8 -C chibi-scheme install"
"snow-chibi install --always-yes retropikzel.compile-r7rs"))
(library-stage
(lambda (scheme library-name)
(list (string->symbol library-name)
(string-append "timeout 60 make SCHEME="
scheme
" LIBRARY="
library-name
" all install test")))))
`((jenkinsfile
(agent "label 'docker-x86_64'")
(options "disableConcurrentBuilds()"
"buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))"))
(makings ,@(map (lambda (scheme)
`((name ,scheme)
(image ,(string-append "schemers/" scheme ":head"))
(stages
(init ,@init)
,@(map
(lambda (library-name)
(library-stage scheme library-name))
libraries))))
schemes))))

15
retropikzel/assert.scm Normal file
View File

@ -0,0 +1,15 @@
(define-syntax assert
(syntax-rules ()
((_ check body)
(let ((result body))
(when (not (check result))
(error "assertion error: " check body result))
result))))
(define-syntax asserts
(syntax-rules ()
((_ (check ...) body)
(let ((result body))
(when (not (check result)) (error "assertion error: " check body result)) ...
result))))

7
retropikzel/assert.sld Normal file
View File

@ -0,0 +1,7 @@
(define-library
(retropikzel assert)
(import (scheme base)
(scheme write))
(export assert
asserts)
(include "assert.scm"))

165
retropikzel/assert/LICENSE Normal file
View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@ -0,0 +1 @@
WIP

View File

@ -0,0 +1 @@
0.1.0

View File

@ -0,0 +1,21 @@
(import (scheme base)
(scheme write)
(scheme read)
(retropikzel tap)
(retropikzel debug)
(retropikzel assert)
(srfi 64))
(test-runner-current (tap-runner))
(test-begin "assert")
(test-equal 1 (assert number? 1))
(test-equal 'error
(guard (condition (else 'error))
(assert number? "string")))
(test-equal 1 (asserts (number? (lambda (i) (= i 1))) 1))
(test-end "assert")

View File

@ -1,3 +1,7 @@
(define debug?
(and (get-environment-variable "SCM_DEBUG")
(equal? (get-environment-variable "SCM_DEBUG") "1")))
(define print (define print
(lambda args (lambda args
(map (lambda (item) (display item (current-error-port))) args))) (map (lambda (item) (display item (current-error-port))) args)))
@ -6,22 +10,21 @@
(syntax-rules () (syntax-rules ()
((_ obj) ((_ obj)
(begin (begin
(print "[DEBUG] " 'obj ": " obj #\newline) (when debug? (print "[DEBUG] " 'obj ": " obj #\newline))
obj)))) obj))))
(define-syntax debug (define-syntax debug
(syntax-rules () (syntax-rules ()
((_ obj) ((_ obj)
(begin (begin
(print "[DEBUG] " 'obj ": " obj #\newline) (when debug? (print "[DEBUG] " 'obj ": " obj #\newline))
obj)))) obj))))
(define-syntax debug-proc (define-syntax debug-proc
(syntax-rules () (syntax-rules ()
((_ proc arg ...) ((_ proc arg ...)
(begin (begin
(print "[DEBUG] Calling: " 'proc ", arguments: " '(arg ...)) (when debug? (print "[DEBUG] Calling: " 'proc ", arguments: " '(arg ...)))
(let ((result (apply proc (list arg ...)))) (let ((result (apply proc (list arg ...))))
(print ", returned: " result #\newline) (when debug? (print ", returned: " result #\newline))
result))))) result)))))

View File

@ -1,7 +1,8 @@
(define-library (define-library
(retropikzel debug) (retropikzel debug)
(import (scheme base) (import (scheme base)
(scheme write)) (scheme write)
(scheme process-context))
(export debug (export debug
debug-display debug-display
debug-proc) debug-proc)

View File

@ -1,3 +1,11 @@
(import (scheme base)
(scheme write)
(retropikzel tap)
(retropikzel debug)
(srfi 64))
(test-runner-current (tap-runner))
(test-begin "debug") (test-begin "debug")
(debug 'lol) (debug 'lol)

100
retropikzel/dot-locking.scm Normal file
View File

@ -0,0 +1,100 @@
(define (make-lock-file-name file-name) (string-append file-name ".lock"))
(define (sleep time)
(letrec*
((end-time
(let ((end-time (current-time))
(seconds (quotient time 1000))
(nanoseconds (* (remainder time 1000) 1000000)))
(set-time-second! end-time (+ (time-second end-time) seconds))
(set-time-nanosecond! end-time (+ (time-nanosecond end-time) nanoseconds))
end-time))
(looper (lambda () (when (time<? (current-time) end-time) (looper)))))
(looper)))
(define (obtain-dot-lock file-name . args)
(let* ((interval
(* (if (>= (length args) 1)
(let ((interval (list-ref args 0)))
(when (not (integer? interval))
(error (string-append "obtain-dot-lock error: interval must"
" be integer"
interval)))
interval)
1000)))
(retry-number
(if (>= (length args) 2)
(let ((retry-number (list-ref args 1)))
(when (and (not (integer? retry-number))
(not (equal? retry-number #f)))
(error (string-append "obtain-dot-lock error: retry-number must"
" be integer or #f")
retry-number))
retry-number)
#f))
(stale-time-seconds
(if (>= (length args) 3)
(let ((stale-time (list-ref args 2)))
(when (and (not (integer? stale-time))
(not (equal? stale-time #f)))
(error (string-append "obtain-dot-lock error: stale time must"
" be integer or #f")
stale-time))
stale-time)
300))
(stale-time
(if stale-time-seconds
(add-duration (current-time time-utc)
(make-time time-duration 0 stale-time-seconds))
#f))
(lock-file-name (make-lock-file-name file-name))
(lock-time (lambda ()
(guard (condition (else #f))
(file-info:ctime (file-info lock-file-name #f))))))
(letrec
((locker
(lambda (try-count)
(cond ((not (file-exists? lock-file-name))
(guard (condition (else (locker (+ try-count 1))))
(create-hard-link file-name lock-file-name)
#t))
((and retry-number (> try-count retry-number)) #f)
((and stale-time (time>? lock-time stale-time))
(break-dot-lock file-name)
(create-hard-link file-name lock-file-name)
(guard (condition (else #f))
(create-hard-link file-name lock-file-name)
'broken))
((or (not retry-number)
(<= try-count retry-number))
(sleep interval)
(locker (+ try-count)))))))
(locker 0))))
(define (break-dot-lock file-name)
(let ((lock-file-name (make-lock-file-name file-name)))
(when (file-exists? lock-file-name) (delete-file lock-file-name))))
(define (release-dot-lock file-name)
(let ((lock-file-name (make-lock-file-name file-name)))
(guard (condition (else #f))
(when (file-exists? lock-file-name)
(delete-file lock-file-name))
#t)))
(define-syntax with-dot-lock*
(syntax-rules ()
((_ file-name thunk)
(letrec* ((locked? (obtain-dot-lock file-name))
(unlock (lambda ()
(when locked? (break-dot-lock file-name))
(set! locked? #f))))
(when locked?
(dynamic-wind (lambda () #t)
(lambda () (guard (condition (else (unlock))) (thunk)))
unlock))
(unlock)))))
(define-syntax with-dot-lock
(syntax-rules ()
((_ file-name body ...)
(with-dot-lock* file-name (lambda () body ...)))))

View File

@ -0,0 +1,13 @@
(define-library
(retropikzel dot-locking)
(import (scheme base)
(scheme write)
(scheme file)
(srfi 19)
(srfi 170))
(export obtain-dot-lock
break-dot-lock
release-dot-lock
with-dot-lock*
with-dot-lock)
(include "dot-locking.scm"))

View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@ -0,0 +1,55 @@
Dot locking for files
This is an implementation of dot-locking from [scsh](https://scsh.net/).
## Documentation
From [https://scsh.net/docu/html/man-Z-H-11.html#node_sec_10.3](https://scsh.net/docu/html/man-Z-H-11.html#node_sec_10.3)
Copied here for convenience.
(__obtain-dot-lock__ file-name)
Tries to obtain the lock for file-name. If the file is already locked, the thread
sleeps for interval seconds (default is 1) before it retries. If the lock cannot
be obtained after retry-number attempts, the procedure returns #f, other-
wise #t. The default value of retry-number is #f which corresponds to an
infinite number of retires.
If stale-time is non-#f, it specifies the minimum age a lock may have
(in seconds) before it is considered stale. Obtain-dot-lock attempts to
delete stale locks. If it was succcessful obtaining a lock after breaking
it, obtain-dot-lock returns broken. If stale-time is #f, obtain-dot-lock
never considers a lock stale. The default for stale-time is 300.
Note that it is possible that obtain-dot-lock breaks a lock but never-
theless fails to obtain it otherwise. If it is necessary to handle this case
specially, use break-dot-lock directly (see below) rather than specifying
a non-#f stale-time
(__break-dot-lock__ file-name)
Breaks the lock for file-name if one exists. Note that breaking a lock
does not imply a subsequent obtain-dot-lock will succeed, as an-
other party may have acquired the lock between break-dot-lock and
obtain-dot-lock.
(__release-dot-lock__ file-name)
Releases the lock for file-name. On success, release-dot-lock returns #t,
otherwise #f. Note that this procedure can also be used to break the lock
for file-name.
(__with-dot-lock*__ file-name thunk)
(__with-dot-lock__ file-name body ...)
The procedure with-dot-lock* obtains the requested lock, and then calls
(thunk). When thunk returns, the lock is released. A non-local exit (e.g.,
throwing to a saved continuation or raising an exception) also causes the
lock to be released.
After a normal return from thunk, its return values are returned by
with-dot-lock*. The with-dot-lock special form is equivalent syntac-
tic sugar.

View File

@ -0,0 +1 @@
1.0.1

View File

@ -0,0 +1,73 @@
(import (scheme base)
(scheme write)
(scheme read)
(scheme char)
(scheme file)
(scheme process-context)
(retropikzel tap)
(retropikzel dot-locking)
(srfi 64))
(test-runner-current (tap-runner))
(test-begin "dot-locking")
(test-begin "obtain-dot-lock")
(let* ((testfile "/tmp/scshtestfile.txt")
(lockfile (string-append testfile ".lock")))
(when (file-exists? testfile) (delete-file testfile))
(when (file-exists? lockfile) (delete-file lockfile))
(with-output-to-file testfile (lambda () (display 1)))
(obtain-dot-lock testfile)
(test-assert (file-exists? lockfile)))
(test-end "obtain-dot-lock")
(test-begin "break-dot-lock")
(let* ((testfile "/tmp/scshtestfile.txt")
(lockfile (string-append testfile ".lock")))
(when (file-exists? testfile) (delete-file testfile))
(when (file-exists? lockfile) (delete-file lockfile))
(with-output-to-file testfile (lambda () (display 1)))
(obtain-dot-lock testfile)
(break-dot-lock testfile)
(test-assert (not (file-exists? lockfile))))
(test-end "break-dot-lock")
(test-begin "release-dot-lock")
(let* ((testfile "/tmp/scshtestfile.txt")
(lockfile (string-append testfile ".lock")))
(when (file-exists? testfile) (delete-file testfile))
(when (file-exists? lockfile) (delete-file lockfile))
(with-output-to-file testfile (lambda () (display 1)))
(obtain-dot-lock testfile)
(test-assert (release-dot-lock testfile)))
(test-end "release-dot-lock")
(test-begin "with-dot-lock*")
(let* ((testfile "/tmp/scshtestfile.txt")
(lockfile (string-append testfile ".lock")))
(when (file-exists? testfile) (delete-file testfile))
(when (file-exists? lockfile) (delete-file lockfile))
(with-output-to-file testfile (lambda () (display 1)))
(with-dot-lock*
testfile
(lambda ()
(test-assert (file-exists? lockfile)))))
(test-end "with-dot-lock*")
(test-begin "with-dot-lock")
(let* ((testfile "/tmp/scshtestfile.txt")
(lockfile (string-append testfile ".lock")))
(when (file-exists? testfile) (delete-file testfile))
(when (file-exists? lockfile) (delete-file lockfile))
(with-output-to-file testfile (lambda () (display 1)))
(with-dot-lock testfile (test-assert (file-exists? lockfile))))
(test-end "with-dot-lock")
(test-end "dot-locking")

4
retropikzel/match.scm Normal file
View File

@ -0,0 +1,4 @@
(define-syntax match
(syntax-rules (or)
((_ val compare-with (compare-to body ...) ...)
(cond ((compare-with val compare-to) body ...) ...))))

6
retropikzel/match.sld Normal file
View File

@ -0,0 +1,6 @@
(define-library
(retropikzel match)
(import (scheme base)
(scheme write))
(export match)
(include "match.scm"))

165
retropikzel/match/LICENSE Normal file
View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@ -0,0 +1 @@
WIP

View File

@ -0,0 +1 @@
0.1.0

View File

@ -0,0 +1,17 @@
(import (scheme base)
(scheme write)
(retropikzel tap)
(retropikzel match)
(retropikzel debug)
(srfi 64))
(test-runner-current (tap-runner))
(test-begin "match")
(define val "Hello")
(test-equal 1 (debug (match val equal? ("world" 0) ("Hello" 1))))
(test-equal 1 (debug (match 2 = (1 0) (2 1))))
(test-end "match")

View File

@ -1,6 +1,27 @@
(define tap-output-port (current-output-port)) ;;> \pre{
(define (set-tap-runner-output-port! port) (set! tap-output-port port)) ;;> TAP output for SRFI-64
;;>
;;> [Test Anything Protocol](https://testanything.org/)
;;>
;;>}
;;> \section{Usage}
;;> \pre{
;;> (import (scheme base)
;;> (srfi 64)
;;> (retropikzel tap))
;;>
;;> (test-runner-current (tap-runner))
;;>
;;> (test-begin "My Cool Library")
;;> (test-equal 1 1)
;;> (test-end "My Cool Library")
;;>}
;;> \section{Reference}
;;>Get the TAP test runner.
(define-syntax tap-runner (define-syntax tap-runner
(syntax-rules () (syntax-rules ()
((_) ((_)
@ -20,23 +41,27 @@
(print (print
(lambda args (lambda args
(map (lambda (item) (map (lambda (item)
(display item tap-output-port)) (display item))
(append indentation args)))) (append indentation args))))
(println (println
(lambda args (lambda args
(map (lambda (item) (map (lambda (item)
(display item tap-output-port)) (display item))
(append indentation args)) (append indentation args))
(display "\n" tap-output-port))) (display "\n")))
(runner (test-runner-null)) (runner (test-runner-null))
(started? #f) (started? #f)
(current-test-groups (vector)) (current-test-groups (vector))
(current-test-group-count 0) (current-test-group-count 0)
(current-suite-name #f)) (current-suite-name #f)
(exit-with-fail? #f))
(test-runner-on-group-begin! (test-runner-on-group-begin!
runner runner
(lambda (runner suite-name count) (lambda (runner suite-name count)
(when (not started?)
(println "TAP version 14")
(set! started? #t))
(set! current-test-group-count 0) (set! current-test-group-count 0)
(when current-suite-name (when current-suite-name
(println "# Subtest: " suite-name) (println "# Subtest: " suite-name)
@ -60,9 +85,6 @@
(test-runner-on-test-begin! (test-runner-on-test-begin!
runner runner
(lambda (runner) (lambda (runner)
(when (not started?)
(println "TAP version 14")
(set! started? #t))
(set! current-test-group-count (+ current-test-group-count 1)))) (set! current-test-group-count (+ current-test-group-count 1))))
(test-runner-on-test-end! (test-runner-on-test-end!
@ -81,7 +103,9 @@
(let ((value (test-result-ref runner key))) (let ((value (test-result-ref runner key)))
(if value (any->string value) ""))))) (if value (any->string value) "")))))
(let* ((failed? (or (equal? result 'fail) (equal? result 'xfail)))) (let* ((failed? (or (equal? result 'fail) (equal? result 'xfail))))
(when failed? (print "not ")) (when failed?
(set! exit-with-fail? #t)
(print "not "))
(print "ok " current-test-group-count) (print "ok " current-test-group-count)
(if (and (string? name) (not (string=? name ""))) (if (and (string? name) (not (string=? name "")))
(println " - " name) (println " - " name)
@ -96,4 +120,10 @@
(println " at: ") (println " at: ")
(println " file: " (result-ref runner 'source-file)) (println " file: " (result-ref runner 'source-file))
(println " line: " (result-ref runner 'source-line))))))) (println " line: " (result-ref runner 'source-line)))))))
(test-runner-on-final!
runner
(lambda (runner)
(when exit-with-fail? (exit 1))))
runner)))) runner))))

View File

@ -2,8 +2,8 @@
(retropikzel tap) (retropikzel tap)
(import (scheme base) (import (scheme base)
(scheme write) (scheme write)
(scheme process-context)
(srfi 64)) (srfi 64))
(export tap-runner (export tap-runner)
set-tap-runner-output-port!)
(include "tap.scm")) (include "tap.scm"))

View File

@ -1 +1 @@
0.2.1 0.3.1

View File

@ -1,3 +1,6 @@
(import (scheme base)
(retropikzel tap)
(srfi 64))
(test-runner-current (tap-runner)) (test-runner-current (tap-runner))
@ -8,8 +11,8 @@
(test-begin "tap 1") (test-begin "tap 1")
(test-assert #t) (test-assert #t)
(test-assert #t) (test-assert #t)
(test-assert #f) ;(test-assert #f)
(test-equal '(1 2 3) '(4 5 6)) ;(test-equal '(1 2 3) '(4 5 6))
(test-end "tap 1") (test-end "tap 1")
(test-begin "tap 2") (test-begin "tap 2")
@ -19,6 +22,6 @@
(test-end "tap 2") (test-end "tap 2")
(test-assert #t) (test-assert #t)
(test-equal '(4 5 6) '(7 8 9)) ;(test-equal '(4 5 6) '(7 8 9))
(test-end "tap") (test-end "tap")