<commit_before>(declaim (optimize (speed 0) (safety 3) (space 0) (debug 3) (compilation-speed 0)))

(let ((here (truename ".")))
  (push here asdf:*central-registry*)
  (push (merge-pathnames #P"test/" here) asdf:*central-registry*))

(handler-bind
    ((error
      (lambda (c)
        (unless (interactive-stream-p *standard-output*)
          (format *error-output* "Fatal error: ~A~%" c)
          (uiop:quit 1)))))
  (asdf:load-system :shcl-test)

  (let* ((env-sym (intern "ENV" (find-package "SHCL/CORE/ENVIRONMENT")))
         (run-tests-sym (intern "RUN-TESTS" (find-package "SHCL-TEST/MAIN")))
         (interactive-p (interactive-stream-p *standard-output*))
         (target-file (funcall env-sym "TEST_OUTPUT" nil))
         (stream
          (if target-file
              (open target-file :direction :output :if-exists :supersede :external-format :utf8)
              *standard-output*)))
    (funcall run-tests-sym :enable-colors interactive-p :output-stream stream)
    (finish-output stream))
  (uiop:quit 0))<commit_msg>Use uiop to access environment in test.lisp<commit_after>(declaim (optimize (speed 0) (safety 3) (space 0) (debug 3) (compilation-speed 0)))

(let ((here (truename ".")))
  (push here asdf:*central-registry*)
  (push (merge-pathnames #P"test/" here) asdf:*central-registry*))

(handler-bind
    ((error
      (lambda (c)
        (unless (interactive-stream-p *standard-output*)
          (format *error-output* "Fatal error: ~A~%" c)
          (uiop:quit 1)))))
  (asdf:load-system :shcl-test)

  (let* ((run-tests-sym (intern "RUN-TESTS" (find-package "SHCL-TEST/MAIN")))
         (interactive-p (interactive-stream-p *standard-output*))
         (target-file (uiop:getenv "TEST_OUTPUT"))
         (stream
          (if target-file
              (open target-file :direction :output :if-exists :supersede :external-format :utf8)
              *standard-output*)))
    (funcall run-tests-sym :enable-colors interactive-p :output-stream stream)
    (finish-output stream))
  (uiop:quit 0))
{'fraction_non_alphanumeric': 0.16625555007400097, 'fraction_numerical': 0.007893438579181056, 'mean_word_length': 3.096969696969697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5338152', 'n_tokens_mistral': 708, 'n_tokens_neox': 673, 'n_words': 160}