From eeide at cs.utah.edu Thu Mar 12 08:31:31 2020 From: eeide at cs.utah.edu (Eric Eide) Date: Thu, 12 Mar 2020 08:31:31 -0600 Subject: [xsmith-dev] Related Work Message-ID: New, sort-of-related work: A property-based testing library for Racket. https://github.com/Bogdanp/rackcheck -- ------------------------------------------------------------------------------- Eric Eide . University of Utah School of Computing http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX From u1129777 at utah.edu Sun Mar 22 23:45:15 2020 From: u1129777 at utah.edu (TUO ZHAO) Date: Mon, 23 Mar 2020 05:45:15 +0000 Subject: [xsmith-dev] [Error 004] After update Racket to the newest version Message-ID: Hi all, I hope you doing well. I tried to use updated Racket (7.6) and XSmith from https://gitlab.flux.utah.edu/xsmith/xsmith.git to run the examples in https://docs.racket-lang.org/xsmith/index.html#%28part._.Minimal_.Example%29 And all of the examples give me Error 004 (which never appears when I use Racket 7.0 with newest version of XSmith) I think the program runs correctly, since it gives me the result like before. But this error is really annoying. I attached all the output details with this email and hope those outputs can provide enough information. Please let me know if there is anything else I can provide. Hope for your reply, Best, Jack -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: error.txt URL: From eeide at cs.utah.edu Mon Mar 23 07:30:38 2020 From: eeide at cs.utah.edu (Eric Eide) Date: Mon, 23 Mar 2020 07:30:38 -0600 Subject: [xsmith-dev] [Error 004] After update Racket to the newest version In-Reply-To: (TUO ZHAO's message of "Mon, 23 Mar 2020 05:45:15 +0000") References: Message-ID: TUO ZHAO writes: > I tried to use updated Racket (7.6) and XSmith from > https://gitlab.flux.utah.edu/xsmith/xsmith.git to run the examples in > https://docs.racket-lang.org/xsmith/index.html#%28part._.Minimal_.Example%29 I have not dug into the problem you repored, but it looks like you are *not* using Racket 7.6. The output of Xsmith shows that you are running Racket 7.2. My advice: Make sure that you have only one copy of Racket installed. > !!! Xsmith Error !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > Error 004: Error encountered while generating program! > > Options: > Version: xsmith 1.2.0 (8d86c5d), in Racket 7.2 > Options: > Seed: 1094154696 > Debug Log: -- ------------------------------------------------------------------------------- Eric Eide . University of Utah School of Computing http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX From u1129777 at utah.edu Mon Mar 23 14:59:48 2020 From: u1129777 at utah.edu (TUO ZHAO) Date: Mon, 23 Mar 2020 20:59:48 +0000 Subject: [xsmith-dev] xsmith-dev Digest, Vol 4, Issue 2 In-Reply-To: References: Message-ID: Hi Professor Edie, Sorry for the confusing out put I attached, the reason it shows Racket 7.2 is that I also tested the program in Racket 7.2 and I attached the wrong output. I tested both Racket 7.6 and 7.2 in my own machine (Ubuntu), in a virtual machine with Kali Linux as well as set up an Emulab (Ubuntu 16.04.1 LTS). And all of those setups shows the same error. Here is what I did: 1) `wget https://mirror.racket-lang.org/installers/7.6/racket-7.6-x86_64-linux.sh` 2) `chmod +x racket-7.6-x86_64-linux.sh` 3) `./racket-7.6-x86_64-linux.sh`, select all default settings, and for emulab I change the path to `./racket` which is the current directory I'm in 4) Then I added `racket/bin` to PATH so that I could call `racket` 5) Then I clone the latest XSmith: `git clone https://gitlab.flux.utah.edu/xsmith/xsmith.git` 6) `cd xsmith` and `make` After all those steps, I run the example and get error. I attached more details output with this email, as well as the example I run (which I just copied from the XSmith doc (https://docs.racket-lang.org/xsmith/index.html#%28part._.Minimal_.Example%29). All the best, Jack ________________________________ From: xsmith-dev-bounces at flux.utah.edu on behalf of xsmith-dev-request at flux.utah.edu Sent: Monday, March 23, 2020 12:00 PM To: xsmith-dev at flux.utah.edu Subject: xsmith-dev Digest, Vol 4, Issue 2 Send xsmith-dev mailing list submissions to xsmith-dev at flux.utah.edu To subscribe or unsubscribe via the World Wide Web, visit http://www.flux.utah.edu/mailman/listinfo/xsmith-dev or, via email, send a message with subject or body 'help' to xsmith-dev-request at flux.utah.edu You can reach the person managing the list at xsmith-dev-owner at flux.utah.edu When replying, please edit your Subject line so it is more specific than "Re: Contents of xsmith-dev digest..." Today's Topics: 1. [Error 004] After update Racket to the newest version (TUO ZHAO) 2. Re: [Error 004] After update Racket to the newest version (Eric Eide) ---------------------------------------------------------------------- Message: 1 Date: Mon, 23 Mar 2020 05:45:15 +0000 From: TUO ZHAO To: "xsmith-dev at flux.utah.edu" Subject: [xsmith-dev] [Error 004] After update Racket to the newest version Message-ID: Content-Type: text/plain; charset="iso-8859-1" Hi all, I hope you doing well. I tried to use updated Racket (7.6) and XSmith from https://gitlab.flux.utah.edu/xsmith/xsmith.git to run the examples in https://docs.racket-lang.org/xsmith/index.html#%28part._.Minimal_.Example%29 And all of the examples give me Error 004 (which never appears when I use Racket 7.0 with newest version of XSmith) I think the program runs correctly, since it gives me the result like before. But this error is really annoying. I attached all the output details with this email and hope those outputs can provide enough information. Please let me know if there is anything else I can provide. Hope for your reply, Best, Jack -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: error.txt URL: ------------------------------ Message: 2 Date: Mon, 23 Mar 2020 07:30:38 -0600 From: Eric Eide To: Xsmith Dev Mailing List Subject: Re: [xsmith-dev] [Error 004] After update Racket to the newest version Message-ID: Content-Type: text/plain TUO ZHAO writes: > I tried to use updated Racket (7.6) and XSmith from > https://gitlab.flux.utah.edu/xsmith/xsmith.git to run the examples in > https://docs.racket-lang.org/xsmith/index.html#%28part._.Minimal_.Example%29 I have not dug into the problem you repored, but it looks like you are *not* using Racket 7.6. The output of Xsmith shows that you are running Racket 7.2. My advice: Make sure that you have only one copy of Racket installed. > !!! Xsmith Error !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > Error 004: Error encountered while generating program! > > Options: > Version: xsmith 1.2.0 (8d86c5d), in Racket 7.2 > Options: > Seed: 1094154696 > Debug Log: -- ------------------------------------------------------------------------------- Eric Eide . University of Utah School of Computing http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX End of xsmith-dev Digest, Vol 4, Issue 2 **************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: output.txt URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.rkt Type: application/octet-stream Size: 1486 bytes Desc: test.rkt URL: From william at hatch.uno Mon Mar 23 17:06:43 2020 From: william at hatch.uno (William G Hatch) Date: Mon, 23 Mar 2020 17:06:43 -0600 Subject: [xsmith-dev] [Error 004] After update Racket to the newest version] Message-ID: <20200323230643.GA11738@conspirator> [Sorry if people get this twice, I'm re-sending to the list because the first try didn't go through due to subscription issues on the list.] Hello, I think the problem is that you are using a recent Xsmith from gitlab with an example from the documentation for the (stale, old) branch published to the Racket package repository. When working with the latest Xsmith, you should use the latest documentation, too. In other words, don't use the Xsmith docs at `https://docs.racket-lang.org`, but rather use your locally installed documentation. You can get to the local documentation by running `raco docs xsmith` (or with some other search term instead of `xsmith`) in a terminal, or also somehow via DrRacket (I'm sure it's easy, but I don't know how to do it offhand -- I always use `raco docs`). The latest version of the example should work in the latest version of Xsmith. Eventually we will put a newer version of Xsmith on the Racket package repository, at which point the documentation will also be updated. On Mon, Mar 23, 2020 at 05:45:15AM +0000, TUO ZHAO wrote: > Hi all, > > I hope you doing well. > > I tried to use updated Racket (7.6) and XSmith from https://gitlab.flux.utah.edu/xsmith/xsmith.git to run the examples in https://docs.racket-lang.org/xsmith/index.html#%28part._.Minimal_.Example%29 > > And all of the examples give me Error 004 (which never appears when I use Racket 7.0 with newest version of XSmith) > > I think the program runs correctly, since it gives me the result like before. But this error is really annoying. I attached all the output details with this email and hope those outputs can provide enough information. Please let me know if there is anything else I can provide. > > Hope for your reply, > Best, > Jack > !!! Xsmith Error !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > Error 004: Error encountered while generating program! > > Options: > Version: xsmith 1.2.0 (8d86c5d), in Racket 7.2 > Options: > Seed: 1094154696 > Debug Log: > > > Exception: > xsmith-command-line: contract violation > expected: ast-node? > given: # > in: the range of > the 1st argument of > (->* > ((-> ast-node?)) > (#:comment-wrap > (-> (listof string?) string?) > #:default-max-depth > number? > #:extra-parameters > (listof > (list/c > dash-dash-string? > string? > parameter? > (or/c procedure? #f))) > #:features > (listof > (or/c > (list/c symbol? boolean?) > (list/c > symbol? > boolean? > (listof string?)))) > #:format-render > (-> any/c string?) > #:fuzzer-name > (or/c #f string?) > #:fuzzer-version > (or/c #f string?)) > void?) > contract from: > /xsmith/private/xsmith-command-line.rkt > blaming: /root/Downloads/test.rkt > (assuming the contract is correct) > at: /xsmith/private/xsmith-command-line.rkt:46.3 > context...: > /usr/share/racket/collects/racket/contract/private/blame.rkt:347:0: raise-blame-error16 > /root/Downloads/xsmith/xsmith/private/xsmith-command-line.rkt:341:26 > /usr/share/racket/collects/racket/port.rkt:132:0: with-output-to-string > /root/Downloads/xsmith/xsmith/private/xsmith-command-line.rkt:288:8 > /root/Downloads/xsmith/xsmith/private/xsmith-command-line.rkt:282:2: generate-and-print!/xsmith-parameterized > /usr/share/racket/collects/racket/contract/private/arrow-val-first.rkt:430:3 > "/root/Downloads/test.rkt": [running body] > temp37_0 > for-loop > run-module-instance!125 > perform-require!78 > > Program output captured: > (30 + (((28 + 12) + (89 + 56)) + ((84 + 10) + 2))) > ----- End forwarded message ----- From eeide at cs.utah.edu Mon Mar 23 17:12:41 2020 From: eeide at cs.utah.edu (Eric Eide) Date: Mon, 23 Mar 2020 17:12:41 -0600 Subject: [xsmith-dev] [Error 004] After update Racket to the newest version In-Reply-To: (TUO ZHAO's message of "Mon, 23 Mar 2020 20:59:48 +0000") References: Message-ID: TUO ZHAO writes: > Here is what I did: > 1) `wget https://mirror.racket-lang.org/installers/7.6/racket-7.6-x86_64-linux.sh` > 2) `chmod +x racket-7.6-x86_64-linux.sh` > 3) `./racket-7.6-x86_64-linux.sh`, select all default settings, and for emulab I change the path to > `./racket` which is the current directory I'm in > 4) Then I added `racket/bin` to PATH so that I could call `racket` > 5) Then I clone the latest XSmith: `git clone https://gitlab.flux.utah.edu/xsmith/xsmith.git` > 6) `cd xsmith` and `make` > > After all those steps, I run the example and get error. I attached more > details output with this email, as well as the example I run (which I just > copied from the XSmith doc > (https://docs.racket-lang.org/xsmith/index.html#%28part._.Minimal_.Example%29). The problem, likely, is another version mismatch :-(. * You are using the current version of Xsmith from git. * You are reading the documentation from the "public release" version of Xsmith. Xsmith has changed enough since the last public release that the documenation for the public-release version isn't right for the git version. To find the documenation for the git version Xsmith, install Xsmith (your step 6) on your system. Then go to a shell and type: raco docs This should open a web browser window/tab. Scroll down to find "Xsmith" and click on it. Once you do that, you'll see that the example program has changed! Try running that example program. Does it work for you? Thanks --- Eric. -- ------------------------------------------------------------------------------- Eric Eide . University of Utah School of Computing http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX From eeide at cs.utah.edu Mon Mar 23 17:15:53 2020 From: eeide at cs.utah.edu (Eric Eide) Date: Mon, 23 Mar 2020 17:15:53 -0600 Subject: [xsmith-dev] xsmith-dev Digest, Vol 4, Issue 2 In-Reply-To: (TUO ZHAO's message of "Mon, 23 Mar 2020 20:59:48 +0000") References: Message-ID: Also, FWIW, I would suggest not subscribing to the xsmith-dev mailing list in "digest mode." You will receive email answers a little more quickly --- and email threads will make more sense --- if you subscribe in non-digest mode. Happy hacking! --- Eric. -- ------------------------------------------------------------------------------- Eric Eide . University of Utah School of Computing http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX From pmatos at linki.tools Tue Mar 24 08:50:06 2020 From: pmatos at linki.tools (Paulo Matos) Date: Tue, 24 Mar 2020 15:50:06 +0100 Subject: [xsmith-dev] Examples Message-ID: <878sjp7qox.fsf@linki.tools> Hi, I am playing with XSmith to try to create a simple fuzzer for a simple scheme. Initially I thought I would go for r7rs but I can see it's not as straightforward as I initially thought. Of course, with the schemely example things were going to be much quick but not only I cannot run the schemely example, I get: $ raco make schemely.rkt /home/pmatos/dev/xsmith/xsmith-examples/schemely/schemely.rkt:219.0: define-generic-type: expected identifier at: (type covariant) in: (define-generic-type list-type ((type covariant))) compilation context...: /home/pmatos/dev/xsmith/xsmith-examples/schemely/schemely.rkt context...: .../private/runtime-report.rkt:731:0: error/report .../private/runtime-report.rkt:28:0: call-current-failure-handler call-in-empty-metacontinuation-frame apply-transformer dispatch-transformer do-local-expand .../syntax/wrap-modbeg.rkt:46:4 call-in-empty-metacontinuation-frame apply-transformer dispatch-transformer loop finish [repeats 37 more times] pass-1-and-2-loop module-begin-k expand-module My example stands as: ---- #lang racket/base (require xsmith racr xsmith/racr-convenience racket/pretty racket/random racket/list racket/class racket/string racket/port) ;; XSMITH-based fuzzer for R7RS - following Rattle's ;; support for R7RS (define-spec-component r7rs-core) (add-to-grammar r7rs-core [Expression #f () #:prop may-be-generated #f] [Let Expression ([definitions : Definition * = 0 #;(random 3)] [body : DefinitionContext]) #:prop strict-child-order? #t] [LiteralBool Expression ([v = (even? (random 2))])] [LiteralNumber Expression (v) #:prop may-be-generated #f] [LiteralInt LiteralNumber ()] [Not Expression ([Expression])] [If Expression ([test : Expression] [then : Expression] [else : Expression]) #:prop strict-child-order? #t] ) (add-prop r7rs-core fresh [LiteralInt (hash 'v (* (random 1000000) (if (equal? 0 (random 2)) -1 1)))]) ;; helper for render-node-info ;(define (->se sym . children-refs) ; (lambda (n) ; `(,sym ,@(map (lambda (x) (render-node (ast-child x n))) ; children-refs)))) ; ;(define (->se* sym children-ref) ; (lambda (n) ; `(,sym ,@(map (lambda (x) (render-node x)) ; (ast-children (ast-child children-ref n)))))) (add-prop r7rs-core render-node-info [Let (lambda (n) `(let (,@(map (lambda (d) `(,(string->symbol (ast-child 'name d)) ,(render-node (ast-child 'Expression d)))) (ast-children (ast-child 'definitions n)))) ,@(render-node (ast-child 'body n))))] [LiteralBool (lambda (n) (ast-child 'v n))] [LiteralNumber (lambda (n) (ast-child 'v n))]) ;(add-prop ; r7rs-core ; render-hole-info ; [#f (lambda (h) (list 'HOLE (ast-node-type h)))]) ;; Types (define number (base-type 'number)) (define int (base-type 'int number)) (define bool (base-type 'bool)) (define (type-thunks-for-concretization) (list (lambda () int) (lambda () bool))) (add-prop r7rs-core type-info [Let [(fresh-type-variable) (lambda (n t) (hash 'body t 'definitions (lambda (c) (fresh-type-variable))))]] [LiteralBool [bool (no-child-types)]] [LiteralInt [int (no-child-types)]] [If [(fresh-type-variable) (lambda (n t) (hash 'test bool 'then t 'else t))]]) (assemble-spec-components r7rs r7rs-core) (define (r7rs-generate) (parameterize ([current-xsmith-type-constructor-thunks (type-thunks-for-concretization)]) (r7rs-generate-ast 'Expression))) (define (r7rs-format-render forms) (with-output-to-string (lambda () (define (pp x) (pretty-print x (current-output-port) 1)) (for ([form forms]) (pp form))))) (module+ main (xsmith-command-line r7rs-generate #:format-render r7rs-format-render)) --- but I am getting: render-node-info: Identifier not defined as a property. in: render-node-info Can someone provide some hints on how to get this to work? I am not sure I completely understand why this is happening. `add-prop` is supposed to add a new property with the name `render-node-info`, so getting that error is confusing me. Xsmith seems to expect the identifier `render-node-info` to have been previously marked as a property or something or the sort. Kind regards, Paulo Matos From u1129777 at utah.edu Tue Mar 24 13:59:59 2020 From: u1129777 at utah.edu (TUO ZHAO) Date: Tue, 24 Mar 2020 19:59:59 +0000 Subject: [xsmith-dev] xsmith-dev Digest, Vol 4, Issue 4 In-Reply-To: References: Message-ID: Hi Professor Eide, William already helps me solved the problem and everything works great now. I also turn off the `digest mode`, thanks for the reminder. Best, Jack ________________________________ From: xsmith-dev-bounces at flux.utah.edu on behalf of xsmith-dev-request at flux.utah.edu Sent: Tuesday, March 24, 2020 12:00 PM To: xsmith-dev at flux.utah.edu Subject: xsmith-dev Digest, Vol 4, Issue 4 Send xsmith-dev mailing list submissions to xsmith-dev at flux.utah.edu To subscribe or unsubscribe via the World Wide Web, visit http://www.flux.utah.edu/mailman/listinfo/xsmith-dev or, via email, send a message with subject or body 'help' to xsmith-dev-request at flux.utah.edu You can reach the person managing the list at xsmith-dev-owner at flux.utah.edu When replying, please edit your Subject line so it is more specific than "Re: Contents of xsmith-dev digest..." Today's Topics: 1. Re: [Error 004] After update Racket to the newest version (Eric Eide) 2. Re: xsmith-dev Digest, Vol 4, Issue 2 (Eric Eide) 3. Examples (Paulo Matos) ---------------------------------------------------------------------- Message: 1 Date: Mon, 23 Mar 2020 17:12:41 -0600 From: Eric Eide To: Xsmith Dev Mailing List Subject: Re: [xsmith-dev] [Error 004] After update Racket to the newest version Message-ID: Content-Type: text/plain TUO ZHAO writes: > Here is what I did: > 1) `wget https://mirror.racket-lang.org/installers/7.6/racket-7.6-x86_64-linux.sh` > 2) `chmod +x racket-7.6-x86_64-linux.sh` > 3) `./racket-7.6-x86_64-linux.sh`, select all default settings, and for emulab I change the path to > `./racket` which is the current directory I'm in > 4) Then I added `racket/bin` to PATH so that I could call `racket` > 5) Then I clone the latest XSmith: `git clone https://gitlab.flux.utah.edu/xsmith/xsmith.git` > 6) `cd xsmith` and `make` > > After all those steps, I run the example and get error. I attached more > details output with this email, as well as the example I run (which I just > copied from the XSmith doc > (https://docs.racket-lang.org/xsmith/index.html#%28part._.Minimal_.Example%29). The problem, likely, is another version mismatch :-(. * You are using the current version of Xsmith from git. * You are reading the documentation from the "public release" version of Xsmith. Xsmith has changed enough since the last public release that the documenation for the public-release version isn't right for the git version. To find the documenation for the git version Xsmith, install Xsmith (your step 6) on your system. Then go to a shell and type: raco docs This should open a web browser window/tab. Scroll down to find "Xsmith" and click on it. Once you do that, you'll see that the example program has changed! Try running that example program. Does it work for you? Thanks --- Eric. -- ------------------------------------------------------------------------------- Eric Eide . University of Utah School of Computing http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX ------------------------------ Message: 2 Date: Mon, 23 Mar 2020 17:15:53 -0600 From: Eric Eide To: Xsmith Dev Mailing List Subject: Re: [xsmith-dev] xsmith-dev Digest, Vol 4, Issue 2 Message-ID: Content-Type: text/plain Also, FWIW, I would suggest not subscribing to the xsmith-dev mailing list in "digest mode." You will receive email answers a little more quickly --- and email threads will make more sense --- if you subscribe in non-digest mode. Happy hacking! --- Eric. -- ------------------------------------------------------------------------------- Eric Eide . University of Utah School of Computing http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX ------------------------------ Message: 3 Date: Tue, 24 Mar 2020 15:50:06 +0100 From: Paulo Matos To: Xsmith Dev Mailing List Subject: [xsmith-dev] Examples Message-ID: <878sjp7qox.fsf at linki.tools> Content-Type: text/plain Hi, I am playing with XSmith to try to create a simple fuzzer for a simple scheme. Initially I thought I would go for r7rs but I can see it's not as straightforward as I initially thought. Of course, with the schemely example things were going to be much quick but not only I cannot run the schemely example, I get: $ raco make schemely.rkt /home/pmatos/dev/xsmith/xsmith-examples/schemely/schemely.rkt:219.0: define-generic-type: expected identifier at: (type covariant) in: (define-generic-type list-type ((type covariant))) compilation context...: /home/pmatos/dev/xsmith/xsmith-examples/schemely/schemely.rkt context...: .../private/runtime-report.rkt:731:0: error/report .../private/runtime-report.rkt:28:0: call-current-failure-handler call-in-empty-metacontinuation-frame apply-transformer dispatch-transformer do-local-expand .../syntax/wrap-modbeg.rkt:46:4 call-in-empty-metacontinuation-frame apply-transformer dispatch-transformer loop finish [repeats 37 more times] pass-1-and-2-loop module-begin-k expand-module My example stands as: ---- #lang racket/base (require xsmith racr xsmith/racr-convenience racket/pretty racket/random racket/list racket/class racket/string racket/port) ;; XSMITH-based fuzzer for R7RS - following Rattle's ;; support for R7RS (define-spec-component r7rs-core) (add-to-grammar r7rs-core [Expression #f () #:prop may-be-generated #f] [Let Expression ([definitions : Definition * = 0 #;(random 3)] [body : DefinitionContext]) #:prop strict-child-order? #t] [LiteralBool Expression ([v = (even? (random 2))])] [LiteralNumber Expression (v) #:prop may-be-generated #f] [LiteralInt LiteralNumber ()] [Not Expression ([Expression])] [If Expression ([test : Expression] [then : Expression] [else : Expression]) #:prop strict-child-order? #t] ) (add-prop r7rs-core fresh [LiteralInt (hash 'v (* (random 1000000) (if (equal? 0 (random 2)) -1 1)))]) ;; helper for render-node-info ;(define (->se sym . children-refs) ; (lambda (n) ; `(,sym ,@(map (lambda (x) (render-node (ast-child x n))) ; children-refs)))) ; ;(define (->se* sym children-ref) ; (lambda (n) ; `(,sym ,@(map (lambda (x) (render-node x)) ; (ast-children (ast-child children-ref n)))))) (add-prop r7rs-core render-node-info [Let (lambda (n) `(let (,@(map (lambda (d) `(,(string->symbol (ast-child 'name d)) ,(render-node (ast-child 'Expression d)))) (ast-children (ast-child 'definitions n)))) ,@(render-node (ast-child 'body n))))] [LiteralBool (lambda (n) (ast-child 'v n))] [LiteralNumber (lambda (n) (ast-child 'v n))]) ;(add-prop ; r7rs-core ; render-hole-info ; [#f (lambda (h) (list 'HOLE (ast-node-type h)))]) ;; Types (define number (base-type 'number)) (define int (base-type 'int number)) (define bool (base-type 'bool)) (define (type-thunks-for-concretization) (list (lambda () int) (lambda () bool))) (add-prop r7rs-core type-info [Let [(fresh-type-variable) (lambda (n t) (hash 'body t 'definitions (lambda (c) (fresh-type-variable))))]] [LiteralBool [bool (no-child-types)]] [LiteralInt [int (no-child-types)]] [If [(fresh-type-variable) (lambda (n t) (hash 'test bool 'then t 'else t))]]) (assemble-spec-components r7rs r7rs-core) (define (r7rs-generate) (parameterize ([current-xsmith-type-constructor-thunks (type-thunks-for-concretization)]) (r7rs-generate-ast 'Expression))) (define (r7rs-format-render forms) (with-output-to-string (lambda () (define (pp x) (pretty-print x (current-output-port) 1)) (for ([form forms]) (pp form))))) (module+ main (xsmith-command-line r7rs-generate #:format-render r7rs-format-render)) --- but I am getting: render-node-info: Identifier not defined as a property. in: render-node-info Can someone provide some hints on how to get this to work? I am not sure I completely understand why this is happening. `add-prop` is supposed to add a new property with the name `render-node-info`, so getting that error is confusing me. Xsmith seems to expect the identifier `render-node-info` to have been previously marked as a property or something or the sort. Kind regards, Paulo Matos End of xsmith-dev Digest, Vol 4, Issue 4 **************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From eeide at cs.utah.edu Tue Mar 24 14:09:10 2020 From: eeide at cs.utah.edu (Eric Eide) Date: Tue, 24 Mar 2020 14:09:10 -0600 Subject: [xsmith-dev] xsmith-dev Digest, Vol 4, Issue 4 In-Reply-To: (TUO ZHAO's message of "Tue, 24 Mar 2020 19:59:59 +0000") References: Message-ID: TUO ZHAO writes: > William already helps me solved the problem and everything works great now. Great! I'm very glad to hear that. -- ------------------------------------------------------------------------------- Eric Eide . University of Utah School of Computing http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX From pmatos at linki.tools Tue Mar 24 14:15:31 2020 From: pmatos at linki.tools (Paulo Matos) Date: Tue, 24 Mar 2020 21:15:31 +0100 Subject: [xsmith-dev] Examples In-Reply-To: <878sjp7qox.fsf@linki.tools> References: <878sjp7qox.fsf@linki.tools> Message-ID: Uh oh - sorry for this. I just noticed I installed xsmith from raco pkg which installs the very old 1.0 release and was trying to run the examples from the master branch. All good now... Maybe it's time for a new minor release? Paulo Matos On 24 March 2020 15:50:06 CET, Paulo Matos wrote: >Hi, > >I am playing with XSmith to try to create a simple fuzzer for a simple >scheme. Initially I thought I would go for r7rs but I can see it's not >as straightforward as I initially thought. > >Of course, with the schemely example things were going to be much quick >but not only I cannot run the schemely example, I get: > >$ raco make schemely.rkt >/home/pmatos/dev/xsmith/xsmith-examples/schemely/schemely.rkt:219.0: >define-generic-type: expected identifier > at: (type covariant) > in: (define-generic-type list-type ((type covariant))) > compilation context...: > /home/pmatos/dev/xsmith/xsmith-examples/schemely/schemely.rkt > context...: > .../private/runtime-report.rkt:731:0: error/report > .../private/runtime-report.rkt:28:0: call-current-failure-handler > call-in-empty-metacontinuation-frame > apply-transformer > dispatch-transformer > do-local-expand > .../syntax/wrap-modbeg.rkt:46:4 > call-in-empty-metacontinuation-frame > apply-transformer > dispatch-transformer > loop > finish > [repeats 37 more times] > pass-1-and-2-loop > module-begin-k > expand-module > >My example stands as: > >---- >#lang racket/base > >(require xsmith > racr > xsmith/racr-convenience > racket/pretty > racket/random > racket/list > racket/class > racket/string > racket/port) > >;; XSMITH-based fuzzer for R7RS - following Rattle's >;; support for R7RS > >(define-spec-component r7rs-core) > >(add-to-grammar > r7rs-core > > [Expression #f () > #:prop may-be-generated #f] > > [Let Expression ([definitions : Definition * = 0 #;(random 3)] > [body : DefinitionContext]) > #:prop strict-child-order? #t] > > [LiteralBool Expression ([v = (even? (random 2))])] > [LiteralNumber Expression (v) #:prop may-be-generated #f] > [LiteralInt LiteralNumber ()] > > [Not Expression ([Expression])] > >[If Expression ([test : Expression] [then : Expression] [else : >Expression]) > #:prop strict-child-order? #t] > > ) > >(add-prop r7rs-core fresh > [LiteralInt (hash 'v (* (random 1000000) > (if (equal? 0 (random 2)) -1 1)))]) > >;; helper for render-node-info >;(define (->se sym . children-refs) >; (lambda (n) >; `(,sym ,@(map (lambda (x) (render-node (ast-child x n))) >; children-refs)))) >; >;(define (->se* sym children-ref) >; (lambda (n) >; `(,sym ,@(map (lambda (x) (render-node x)) >; (ast-children (ast-child children-ref n)))))) > >(add-prop > r7rs-core > render-node-info > >[Let (lambda (n) `(let (,@(map (lambda (d) `(,(string->symbol >(ast-child 'name d)) > ,(render-node (ast-child 'Expression d)))) > (ast-children (ast-child 'definitions n)))) > ,@(render-node (ast-child 'body n))))] > > [LiteralBool (lambda (n) (ast-child 'v n))] > [LiteralNumber (lambda (n) (ast-child 'v n))]) > >;(add-prop >; r7rs-core >; render-hole-info >; [#f (lambda (h) (list 'HOLE (ast-node-type h)))]) > >;; Types >(define number (base-type 'number)) >(define int (base-type 'int number)) >(define bool (base-type 'bool)) > >(define (type-thunks-for-concretization) > (list (lambda () int) > (lambda () bool))) > >(add-prop > r7rs-core > type-info > > [Let [(fresh-type-variable) (lambda (n t) > (hash 'body t > 'definitions (lambda (c) (fresh-type-variable))))]] > > [LiteralBool [bool (no-child-types)]] > [LiteralInt [int (no-child-types)]] > > [If [(fresh-type-variable) > (lambda (n t) > (hash 'test bool 'then t 'else t))]]) > >(assemble-spec-components > r7rs > r7rs-core) > >(define (r7rs-generate) > (parameterize ([current-xsmith-type-constructor-thunks > (type-thunks-for-concretization)]) > (r7rs-generate-ast 'Expression))) > >(define (r7rs-format-render forms) > (with-output-to-string > (lambda () > (define (pp x) > (pretty-print x (current-output-port) 1)) > (for ([form forms]) > (pp form))))) > >(module+ main > (xsmith-command-line > r7rs-generate > #:format-render r7rs-format-render)) > > --- > >but I am getting: >render-node-info: Identifier not defined as a property. in: >render-node-info > >Can someone provide some hints on how to get this to work? I am not >sure >I completely understand why this is happening. `add-prop` is supposed >to >add a new property with the name `render-node-info`, so getting that >error is confusing me. Xsmith seems to expect the identifier >`render-node-info` to have been previously marked as a property or >something or the sort. > >Kind regards, > >Paulo Matos -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -------------- next part -------------- An HTML attachment was scrubbed... URL: From eeide at cs.utah.edu Tue Mar 24 15:02:01 2020 From: eeide at cs.utah.edu (Eric Eide) Date: Tue, 24 Mar 2020 15:02:01 -0600 Subject: [xsmith-dev] Examples In-Reply-To: (Paulo Matos's message of "Tue, 24 Mar 2020 21:15:31 +0100") References: <878sjp7qox.fsf@linki.tools> Message-ID: Paulo Matos writes: > Uh oh - sorry for this. I just noticed I installed xsmith from raco pkg which > installs the very old 1.0 release and was trying to run the examples from the > master branch. All good now... > > Maybe it's time for a new minor release? Yes, this is a good idea! -- ------------------------------------------------------------------------------- Eric Eide . University of Utah School of Computing http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX From eeide at cs.utah.edu Tue Mar 24 15:05:44 2020 From: eeide at cs.utah.edu (Eric Eide) Date: Tue, 24 Mar 2020 15:05:44 -0600 Subject: [xsmith-dev] Examples In-Reply-To: (Paulo Matos's message of "Tue, 24 Mar 2020 21:15:31 +0100") References: <878sjp7qox.fsf@linki.tools> Message-ID: Paulo Matos writes: > Maybe it's time for a new minor release? Let me add, I am excited that you are trying to use Xsmith! Please do not hesitate to ask questions and report bugs. -- ------------------------------------------------------------------------------- Eric Eide . University of Utah School of Computing http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX From pmatos at linki.tools Wed Mar 25 02:48:33 2020 From: pmatos at linki.tools (Paulo Matos) Date: Wed, 25 Mar 2020 09:48:33 +0100 Subject: [xsmith-dev] Examples In-Reply-To: References: <878sjp7qox.fsf@linki.tools> Message-ID: <875zes7rby.fsf@linki.tools> Eric Eide writes: > Paulo Matos writes: > >> Maybe it's time for a new minor release? > > Let me add, I am excited that you are trying to use Xsmith! Please do not > hesitate to ask questions and report bugs. Thank you - I think this is a great project and it's great that it's done in Racket. I am sure I will be causing some traffic here. :) -- Paulo Matos From pmatos at linki.tools Wed Mar 25 03:16:30 2020 From: pmatos at linki.tools (Paulo Matos) Date: Wed, 25 Mar 2020 10:16:30 +0100 Subject: [xsmith-dev] Attempt at R7RS fuzzer causes racr internal error Message-ID: <87369w7q1d.fsf@linki.tools> Hi all, I am now using xsmith from the master branch and something it generating a racr internal error - likely my fault since I never used racr before. The code is here: https://gist.github.com/pmatos/d57e0788906afe53744d2395a52778b2 I am getting: RACR exception: "Invalid AST rule" 'XsmithBaseNoder7rs->xsmithliftdepth-xsmithlifterwrapped ";" "Unexpected" #\r "character." The reason I am sending this email is because, due to the nature of the error, I have no idea if this is indeed my fault. I cannot see any unexpected character in my stream and do not know where to start since the error leads me nowhere. Could someone please help here? By the way, I am aware this is very similar to Schemely but I did want to type it myself and understand how things are done along the way. :) Kind regards, -- Paulo Matos From william at hatch.uno Wed Mar 25 11:31:49 2020 From: william at hatch.uno (William G Hatch) Date: Wed, 25 Mar 2020 11:31:49 -0600 Subject: [xsmith-dev] Attempt at R7RS fuzzer causes racr internal error In-Reply-To: <87369w7q1d.fsf@linki.tools> References: <87369w7q1d.fsf@linki.tools> Message-ID: <20200325173149.GA23501@conspirator> Xsmith has a number of restrictions on how things can be named because it has to pass identifiers through a racr DSL encoded as symbols. Every so often I find that I missed a restriction. Today I learned that you can't have digits in them. (Or at least not in some places -- but xsmith forges symbols based on other symbols, so it's much easier to just ban digits in symbols sent to racr than write code to handle them more gracefully. At least for now.) I've just pushed a commit that adds digits to the banned characters that it checks during assembly. So now you'll see a much better error message: r7rs-fuzzer.rkt:101:1: add-to-grammar: Grammar names have to fit in RACR's DSL encoded as a symbol, and so can't have special characters -_<>:*+ or numbers in them. So, unfortunately, you may have to write `rsevenrs`, or `rrrrrrrrs` or something in `assemble-spec-components`. Or just name it `fuzzer` or something. Unrelated to this bug, I'm glad you're excited about xsmith! Xsmith has been in a state of great instability, but it is rapidly approaching a much more stable state. I've actually been meaning to write a set of rnrs fuzzers (well, and a lot of other fuzzers as well) in the near future, as various features have been stabilizing. I don't say this to discourage you from writing one -- on the contrary I'm sure you'll end up doing something different than I would which could inform xsmith development. I'm very interested to hear how it goes for you. On Wed, Mar 25, 2020 at 10:16:30AM +0100, Paulo Matos wrote: > >Hi all, > >I am now using xsmith from the master branch and something it generating >a racr internal error - likely my fault since I never used racr before. > >The code is here: >https://gist.github.com/pmatos/d57e0788906afe53744d2395a52778b2 > >I am getting: >RACR exception: "Invalid AST rule" >'XsmithBaseNoder7rs->xsmithliftdepth-xsmithlifterwrapped ";" >"Unexpected" #\r "character." > >The reason I am sending this email is because, due to the nature of the >error, I have no idea if this is indeed my fault. I cannot see any >unexpected character in my stream and do not know where to start since >the error leads me nowhere. > >Could someone please help here? >By the way, I am aware this is very similar to Schemely but I did want >to type it myself and understand how things are done along the way. :) > >Kind regards, >-- >Paulo Matos