]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - reports/slice-21b/failure-controls.lisp
Implement XTM role reification with native conformance evidence
[topic-maps.git] / reports / slice-21b / failure-controls.lisp
1 ;; Fault injection into the existing executor, in a disposable fresh process.
2 ;; These reports are controls, never additional corpus results.
3 (require :asdf)
4 (assert (string= "2.5.4" (lisp-implementation-version)))
5 (setf *compile-verbose* nil *load-verbose* nil)
6 (asdf:load-asd (merge-pathnames "../../topic-maps.asd" *load-truename*))
7 (asdf:load-system "topic-maps/xtm/tests")
8 (let ((mode (uiop:getenv "TOPIC_MAPS_21B_FAULT")))
9 (if (string= mode "mismatch")
10 (let ((original (symbol-function 'topic-maps.cxtm:canonicalize-octets)))
11 (setf (symbol-function 'topic-maps.cxtm:canonicalize-octets)
12 (lambda (&rest args)
13 (let ((actual (copy-seq (apply original args))))
14 (setf (aref actual 0) (logxor 1 (aref actual 0))) actual))))
15 (let* ((original (symbol-function 'topic-maps.xtm:deserialize-octets))
16 (source (cond ((string= mode "xml") "<a><b></a>")
17 ((string= mode "xtm") (topic-maps.xtm.tests::document "<topic id='2bad'/>"))
18 ((string= mode "tmdm") (topic-maps.xtm.tests::document "<itemIdentity href='#a'/><topic id='a'/>"))
19 ((string= mode "unsupported") (topic-maps.xtm.tests::document "<topic id='a'><name><value>N</value></name></topic>"))
20 (t (error "Unknown fault control ~S" mode)))))
21 (setf (symbol-function 'topic-maps.xtm:deserialize-octets)
22 (lambda (bytes &rest args) (declare (ignore bytes))
23 (apply original (topic-maps.xtm.tests::bytes source) args)))))
24 (asdf:test-system "topic-maps/xtm"))
25 (error "Fault control unexpectedly completed without ASDF failure.")