From 98463e32de5493e2c2628d8bcf5831095854ba13 Mon Sep 17 00:00:00 2001 From: rpgoldman Date: Sun, 21 Feb 2021 19:18:39 -0600 Subject: [PATCH 01/12] Update README.md Add a note about hte fork. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2809b8e..75ffe00 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ testcases includes the JSON_checker tests. * 2009 New alternative encoder, the explicit sexp-encoder. * 2011 Json-rpc version 2 format by Robert Goldman. * 2012 Move from darcs to git. +* 2020 Forking to sharplispers to take project into community maintenance. ## Licence From d6595a504eaeaeaaf91050d9fac3a2fbc33cdd18 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 3 May 2022 10:55:38 -0500 Subject: [PATCH 02/12] Build CL-JSON, first part of CI test. --- .github/workflows/ci.yml | 85 ++++++++++++++++++++++++++++++++++++++++ cl-json.asd | 12 +++--- compile-cl-json.lisp | 55 ++++++++++++++++++++++++++ 3 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 compile-cl-json.lisp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0d95e05 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,85 @@ +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + pull_request: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test: + # The type of runner that the job will run on + runs-on: ${{matrix.os}} + + strategy: + matrix: + os: [ubuntu-latest] + lisp: + - ccl + - sbcl + + steps: + - uses: actions/checkout@v2 + + - name: Checkout submodules + shell: bash + run: | + git submodule update --init --recursive + + # Lisp setup copied from here: https://github.com/3b/ci-example/blob/master/.github/workflows/CI.yml + - name: cache .roswell + id: cache-dot-roswell + uses: actions/cache@v1 + with: + path: ~/.roswell + key: ${{ runner.os }}-dot-roswell-${{ matrix.lisp }}-${{ hashFiles('**/*.asd') }} + restore-keys: | + ${{ runner.os }}-dot-roswell-${{ matrix.lisp }}- + ${{ runner.os }}-dot-roswell- + + - name: install roswell + shell: bash + # always run install, since it does some global installs and setup that isn't cached + env: + LISP: ${{ matrix.lisp }} + # Use a previous release of Roswell to avoid error encountered + # due to libcurl3 not being available. + # Source of fix: https://github.com/avodonosov/drakma/commit/fbba29181ba2962f5031da581bd2de4dac98733d + run: | + sudo apt-get install -y libcurl4 + curl -L https://raw.githubusercontent.com/roswell/roswell/a8fd8a3c33078d6f06e6cda9d099dcba6fbefcb7/scripts/install-for-ci.sh | sh + + # Compile first in a separate step to make the test output more readable + - name: compile lisp + shell: bash + run: | + ros -l $PWD/compile-cl-json.lisp + # - name: tests + # shell: bash + # run: | + # ros --no-quicklisp -e "(cl:in-package :cl-user) + # (require :asdf) + # (prin1 (lisp-implementation-type)) (terpri) (prin1 (lisp-implementation-version)) (terpri) + # (princ (uiop:run-program \"date\" :output :string)) + # (prin1 \"${{ matrix.test }}\") (terpri) + # (asdf:initialize-source-registry '(:source-registry (:directory \"$PWD/shop3/\") (:tree \"$PWD/jenkins/ext/\") :inherit-configuration)) + # (declaim (optimize (speed 3))) + # (asdf:load-system :shop3/test) + # (defun test-fail-p (test-result) + # (typecase test-result + # (fiveam::test-passed nil) + # (fiveam::test-failure t) + # (null t) + # (list (find-if (function (lambda (x) (test-fail-p x))) test-result)) + # (t nil))) + # (let ((test-results (fiveam:run! (quote ${{ matrix.test }})))) + # (format t \"Test results are:~%\") + # (princ test-results) (terpri) + # (princ (uiop:run-program \"date\" :output :string)) + # (uiop:quit (if (test-fail-p test-results) 1 0)))" diff --git a/cl-json.asd b/cl-json.asd index 97fa096..06e91d0 100644 --- a/cl-json.asd +++ b/cl-json.asd @@ -22,9 +22,10 @@ :name "cl-json" :description "JSON in Lisp. JSON (JavaScript Object Notation) is a lightweight data-interchange format." :version "0.5.0" - :maintainer "Henrik Hjelte " + :author "Henrik Hjelte " + :maintainer "Robert P. Goldman " :licence "MIT" - :in-order-to ((test-op (test-op "cl-json.test"))) + :in-order-to ((test-op (test-op "cl-json/test"))) :components ((:static-file "cl-json.asd") (:module :src :components ((:file "package") @@ -37,20 +38,19 @@ (:file "utils" :depends-on ("decoder" "encoder")) (:file "json-rpc" :depends-on ("package" "common" "utils" "encoder" "decoder")))))) -(defsystem :cl-json.test +(defsystem :cl-json/test :depends-on (:cl-json :fiveam ) - ;; newer ASDF versions have this implicitly, but I know of no good way to detect this. [2010/01/02:rpg] - :in-order-to ((test-op (load-op "cl-json.test"))) :components ((:module :t :components ((:file "package") (:file "testmisc" :depends-on ("package" "testdecoder" "testencoder")) (:file "testdecoder" :depends-on ("package")) (:file "testencoder" :depends-on ("package")))))) -(defmethod perform ((op test-op) (c (eql (find-system :cl-json.test)))) +(defmethod perform ((op test-op) (c (eql (find-system :cl-json/test)))) (funcall (intern (symbol-name '#:run!) :it.bese.FiveAM) (intern (symbol-name '#:json) :json-test))) (defparameter *cl-json-directory* + (system-definition-pathname "cl-json") (make-pathname :directory (pathname-directory *load-truename*))) diff --git a/compile-cl-json.lisp b/compile-cl-json.lisp new file mode 100644 index 0000000..c78e4f7 --- /dev/null +++ b/compile-cl-json.lisp @@ -0,0 +1,55 @@ +(defpackage compile-cl-json + (:use :common-lisp)) + +(in-package :compile-cl-json) + +(or (or (ignore-errors (require :asdf)) + (find-package "ASDF")) + (load "asdf")) + +(asdf:initialize-source-registry '(:source-registry (:directory :here) + :inherit-configuration)) + +(declaim (optimize (speed 3) (space 3))) + +(defun leave-lisp (message return) + (fresh-line *error-output*) + (when message + (format *error-output* message) + (terpri *error-output*)) + (finish-output *error-output*) + (finish-output *standard-output*) + (uiop:quit return)) + +(defmacro quit-on-error (&body body) + `(call-quitting-on-error (lambda () ,@body))) + +(defun call-quitting-on-error (thunk) + "Unless the environment variable DEBUG_CL_JSON_TEST +is bound, write a message and exit on an error. If +*asdf-test-debug* is true, enter the debugger." + (handler-bind + ((error (lambda (c) + (format *error-output* "~&~a~&" c) + (cond + ((ignore-errors (funcall (find-symbol "GETENV" :asdf) "DEBUG_CL_JSON_TEST")) + (break)) + (t + (finish-output *standard-output*) + (finish-output *trace-output*) + (format *error-output* "~&ABORTING:~% ~S~%" c) + #+sbcl (sb-debug:backtrace 69) + #+clozure (ccl:print-call-history :count 69 :start-frame-number 1) + #+clisp (system::print-backtrace) + (format *error-output* "~&ABORTING:~% ~S~%" c) + (finish-output *error-output*) + (leave-lisp "~&Script failed~%" 1)))))) + (funcall thunk) + (leave-lisp "~&Script succeeded~%" 0))) + + +(quit-on-error + (ql:quickload "fiveam") + (asdf:compile-system "cl-json")) + + From f8aed604ccde8ba609e7fc25aa81133403a674ff Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 3 May 2022 11:23:58 -0500 Subject: [PATCH 03/12] Remove unnecessary step for git submodules. --- .github/workflows/ci.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d95e05..b73ab9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,12 +25,7 @@ jobs: - sbcl steps: - - uses: actions/checkout@v2 - - - name: Checkout submodules - shell: bash - run: | - git submodule update --init --recursive + - uses: actions/checkout@v3 # Lisp setup copied from here: https://github.com/3b/ci-example/blob/master/.github/workflows/CI.yml - name: cache .roswell @@ -56,7 +51,7 @@ jobs: curl -L https://raw.githubusercontent.com/roswell/roswell/a8fd8a3c33078d6f06e6cda9d099dcba6fbefcb7/scripts/install-for-ci.sh | sh # Compile first in a separate step to make the test output more readable - - name: compile lisp + - name: compile cl-json library shell: bash run: | ros -l $PWD/compile-cl-json.lisp From a783eead7b1ed77ae5a0b7a06f46afb31fd24f0f Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 3 May 2022 11:28:08 -0500 Subject: [PATCH 04/12] Fix bug in use of SYSTEM-RELATIVE-PATHNAME. --- cl-json.asd | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cl-json.asd b/cl-json.asd index 06e91d0..76f2db4 100644 --- a/cl-json.asd +++ b/cl-json.asd @@ -51,6 +51,5 @@ (intern (symbol-name '#:json) :json-test))) (defparameter *cl-json-directory* - (system-definition-pathname "cl-json") - (make-pathname :directory (pathname-directory *load-truename*))) + (system-relative-pathname "cl-json" "")) From 867cb11c376fe614989aa59006f546008b09badc Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 3 May 2022 11:31:56 -0500 Subject: [PATCH 05/12] Add full suite of implementations to lisp matrix. --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b73ab9d..7ffcded 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,12 @@ jobs: lisp: - ccl - sbcl + - allegro + - clasp + - clisp + - ecl + - lispworks + - mkcl steps: - uses: actions/checkout@v3 From b1f07bad532192fe9a847ebca6ba4875d8cd2af5 Mon Sep 17 00:00:00 2001 From: rpgoldman Date: Tue, 3 May 2022 11:42:31 -0500 Subject: [PATCH 06/12] Disable Lispworks. Installing Lispworks into Roswell failed. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ffcded..94e5c56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - clasp - clisp - ecl - - lispworks + # - lispworks Lispworks Roswell install is broken - mkcl steps: From f0443eff45288d2d3b99bbb73853374b3535a49c Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 3 May 2022 15:20:19 -0500 Subject: [PATCH 07/12] Revise roswell installation. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94e5c56..7f50ccd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: # Source of fix: https://github.com/avodonosov/drakma/commit/fbba29181ba2962f5031da581bd2de4dac98733d run: | sudo apt-get install -y libcurl4 - curl -L https://raw.githubusercontent.com/roswell/roswell/a8fd8a3c33078d6f06e6cda9d099dcba6fbefcb7/scripts/install-for-ci.sh | sh + curl -L https://raw.githubusercontent.com/roswell/roswell/release/scripts/install-for-ci.sh | sh # Compile first in a separate step to make the test output more readable - name: compile cl-json library From 1af793038a2fb4c94929d82a3d59b500aa36a3ef Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 3 May 2022 15:22:17 -0500 Subject: [PATCH 08/12] Disable clasp, which roswell seems unable to install. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f50ccd..e28a4d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - ccl - sbcl - allegro - - clasp + # - clasp - clisp - ecl # - lispworks Lispworks Roswell install is broken From 9b517b632aa712128137e040c1ecc24175e0ae4d Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 3 May 2022 15:32:00 -0500 Subject: [PATCH 09/12] Disable clisp. Failed to install in roswell successfully. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e28a4d1..58608d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - sbcl - allegro # - clasp - - clisp + # - clisp - ecl # - lispworks Lispworks Roswell install is broken - mkcl From 1944aeafd942239cd686c9cf356070ed063c456d Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 3 May 2022 15:38:42 -0500 Subject: [PATCH 10/12] Simplify ASDF loading. --- compile-cl-json.lisp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compile-cl-json.lisp b/compile-cl-json.lisp index c78e4f7..5e2cda7 100644 --- a/compile-cl-json.lisp +++ b/compile-cl-json.lisp @@ -3,9 +3,7 @@ (in-package :compile-cl-json) -(or (or (ignore-errors (require :asdf)) - (find-package "ASDF")) - (load "asdf")) +(require :asdf) (asdf:initialize-source-registry '(:source-registry (:directory :here) :inherit-configuration)) From 0aa76e7ff89830ee7ad25413e5f7ad75c9286e12 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 3 May 2022 15:39:10 -0500 Subject: [PATCH 11/12] Run the FiveAM tests. --- .github/workflows/ci.yml | 27 +++---------------- test-cl-json.lisp | 57 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 23 deletions(-) create mode 100644 test-cl-json.lisp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58608d3..c3b34b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,26 +61,7 @@ jobs: shell: bash run: | ros -l $PWD/compile-cl-json.lisp - # - name: tests - # shell: bash - # run: | - # ros --no-quicklisp -e "(cl:in-package :cl-user) - # (require :asdf) - # (prin1 (lisp-implementation-type)) (terpri) (prin1 (lisp-implementation-version)) (terpri) - # (princ (uiop:run-program \"date\" :output :string)) - # (prin1 \"${{ matrix.test }}\") (terpri) - # (asdf:initialize-source-registry '(:source-registry (:directory \"$PWD/shop3/\") (:tree \"$PWD/jenkins/ext/\") :inherit-configuration)) - # (declaim (optimize (speed 3))) - # (asdf:load-system :shop3/test) - # (defun test-fail-p (test-result) - # (typecase test-result - # (fiveam::test-passed nil) - # (fiveam::test-failure t) - # (null t) - # (list (find-if (function (lambda (x) (test-fail-p x))) test-result)) - # (t nil))) - # (let ((test-results (fiveam:run! (quote ${{ matrix.test }})))) - # (format t \"Test results are:~%\") - # (princ test-results) (terpri) - # (princ (uiop:run-program \"date\" :output :string)) - # (uiop:quit (if (test-fail-p test-results) 1 0)))" + - name: tests + shell: bash + run: | + ros -l $PWD/test-cl-json.lisp diff --git a/test-cl-json.lisp b/test-cl-json.lisp new file mode 100644 index 0000000..8444710 --- /dev/null +++ b/test-cl-json.lisp @@ -0,0 +1,57 @@ +(defpackage testing-cl-json + (:use common-lisp)) + +(in-package :testing-cl-json) + +(require :asdf) + +(asdf:initialize-source-registry '(:source-registry (:directory :here) + :inherit-configuration)) + +(defun leave-lisp (message return) + (fresh-line *error-output*) + (when message + (format *error-output* message) + (terpri *error-output*)) + (finish-output *error-output*) + (finish-output *standard-output*) + (uiop:quit return)) + +(defmacro quit-on-error (&body body) + `(call-quitting-on-error (lambda () ,@body))) + +(defun call-quitting-on-error (thunk) + "Unless the environment variable DEBUG_CL_JSON_TEST +is bound, write a message and exit on an error. If +*asdf-test-debug* is true, enter the debugger." + (flet ((quit (c desc) + (format *error-output* "~&Encountered ~a during test.~%~a~%" desc c) + (cond + ;; decline to handle the error. + ((ignore-errors (funcall (find-symbol "GETENV" :asdf) "DEBUG_CL_JSON_TEST")) + (format t "~&Interactive mode (DEBUG_CL_JSON_TEST) -- Invoke debugger.~%") + (invoke-debugger c)) + (t + (finish-output *standard-output*) + (finish-output *trace-output*) + (format *error-output* "~&ABORTING:~% ~S~%" c) + (uiop:print-condition-backtrace c) + (format *error-output* "~&ABORTING:~% ~S~%" c) + (finish-output *error-output*) + (leave-lisp "~&Script failed~%" 1))))) + (handler-bind + ((error (lambda (c) + (quit c "ERROR"))) + (storage-condition + (lambda (c) (quit c "STORAGE-CONDITION"))) + (serious-condition (lambda (c) + (quit c "Other SERIOUS-CONDIITON")))) + (funcall thunk) + (format t "~&Script succeeded~%") + t))) + +(quit-on-error + (format t "~&;;; Testing CL-JSON on ~a.~%" (lisp-implementation-type)) + (asdf:test-system "cl-json")) + +(uiop:quit 0) From a45c6c1fe4dd26ec749bd35825decd6b2fdad9d8 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Tue, 3 May 2022 15:48:37 -0500 Subject: [PATCH 12/12] Kill old reference to json.test. Use the new name "json/test" --- t/testdecoder.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/testdecoder.lisp b/t/testdecoder.lisp index 644f905..04e1a56 100644 --- a/t/testdecoder.lisp +++ b/t/testdecoder.lisp @@ -267,7 +267,7 @@ safe-symbols-parsing function here for a cure." (defparameter *json-test-files-path* - (asdf:system-relative-pathname "cl-json.test" "t/")) + (asdf:system-relative-pathname "cl-json/test" "t/")) (defun test-file (name) (make-pathname :name name :type "json" :defaults *json-test-files-path*))