This file is indexed.

/usr/share/acl2-6.3/books/parallel/stress-tests.lisp is in acl2-books-source 6.3-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
; This book provides "stress tests" for determining whether the parallelism
; library is working well.  The intent is that a person who modifies the ACL2
; mulit-threading interface and the parallelism library can gain moderate
; assurance that their changes did not break plet, pargs, pand, and por by
; certifying this book.  It is also useful for testing release candidates for
; CCL and SBCL.

; Code in all caps is effectively evaluated from a raw lisp prompt.

; To certify this book, you can type:
;
; (certify-book "stress-tests" 0 t :ttags :all)

(in-package "ACL2")

(include-book "misc/assert" :dir :system)
(include-book "misc/eval" :dir :system)

(defttag raw-lisp-for-parallelism-tests)

(defconst *level-of-pain* 100)

(set-compile-fns t) ; avoid a stack overflow in allegro

;;;;;;;;;;
;; plet ;;
;;;;;;;;;;

(defun plet-test (n)
  (declare (xargs :guard (natp n)))
  (if (zp n)
      t
    (and (assert$ (equal (plet ((x 3) (y 7)) (+ x y)) 10) t)
         (plet-test (1- n)))))

(assert! (plet-test *level-of-pain*))

#+acl2-par
(progn! (set-raw-mode t)
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (ASSERT (PLET-TEST *LEVEL-OF-PAIN*))
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (SET-RAW-MODE NIL))

;;;;;;;;;;;
;; pargs ;;
;;;;;;;;;;;

(defun pargs-test (n)
  (declare (xargs :guard (natp n)))
  (if (zp n)
      t
    (and (assert$ (equal (pargs (binary-+ 3 7)) 10) t)
         (pargs-test (1- n)))))

(assert! (pargs-test *level-of-pain*))

#+acl2-par
(progn! (set-raw-mode t)
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (ASSERT (PARGS-TEST *LEVEL-OF-PAIN*))
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (SET-RAW-MODE NIL))

;;;;;;;;;;
;; pand ;;
;;;;;;;;;;

(defun pand-true (n)
  (declare (xargs :guard (natp n)))
  (if (zp n)
      t
    (and (assert$ (equal (pand 1 2 3 4 5 6 7 8 9 0) t)
                  t)
         (pand-true (1- n)))))

(assert! (pand-true *level-of-pain*))

#+acl2-par
(progn! (set-raw-mode t)
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (ASSERT (PAND-TRUE *LEVEL-OF-PAIN*))
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (SET-RAW-MODE NIL))


(defun pand-false-one (n)
  (declare (xargs :guard (natp n)))
  (if (zp n)
      t
    (and (assert$ (not (pand 1 2 3 nil 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0)) t)
         (pand-false-one (1- n)))))


(assert! (pand-false-one *level-of-pain*))

#+acl2-par
(progn! (set-raw-mode t)
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (ASSERT (PAND-FALSE-ONE *LEVEL-OF-PAIN*))
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (SET-RAW-MODE NIL))


(defun pand-false-many (n)
  (declare (xargs :guard (natp n)))
  (if (zp n)
      t
    (and (assert$ (not (pand 1 2 3 nil 5 nil nil nil 9 0 1 2 3 4 5 6 7 8 9)) t)
         (pand-false-many (1- n)))))

(assert! (pand-false-many *level-of-pain*))

#+acl2-par
(progn! (set-raw-mode t)
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (ASSERT (PAND-FALSE-MANY *LEVEL-OF-PAIN*))
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (SET-RAW-MODE NIL))

;;;;;;;;;
;; por ;;
;;;;;;;;;

(defun por-true-many (n)
  (declare (xargs :guard (natp n)))
  (if (zp n)
      t
    (and (assert$ (por nil nil nil nil nil nil nil 5 6 nil nil nil 9 nil) t)
         (por-true-many (1- n)))))

(assert! (por-true-many *level-of-pain*))

#+acl2-par
(progn! (set-raw-mode t)
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (ASSERT (POR-TRUE-MANY *LEVEL-OF-PAIN*))
        (ASSERT (PARALLELISM-RESOURCES-AVAILABLE))
        (SET-RAW-MODE NIL))