[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xsmith-dev] xsmith-dev Digest, Vol 4, Issue 4



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@flux.utah.edu <xsmith-dev-bounces@flux.utah.edu> on behalf of xsmith-dev-request@flux.utah.edu <xsmith-dev-request@flux.utah.edu>
Sent: Tuesday, March 24, 2020 12:00 PM
To: xsmith-dev@flux.utah.edu <xsmith-dev@flux.utah.edu>
Subject: xsmith-dev Digest, Vol 4, Issue 4
 
Send xsmith-dev mailing list submissions to
        xsmith-dev@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@flux.utah.edu

You can reach the person managing the list at
        xsmith-dev-owner@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 <eeide@cs.utah.edu>
To: Xsmith Dev Mailing List <xsmith-dev@flux.utah.edu>
Subject: Re: [xsmith-dev] [Error 004] After update Racket to the
        newest  version
Message-ID: <m1mu86vf6e.fsf_-_@cs.utah.edu>
Content-Type: text/plain

TUO ZHAO <u1129777@utah.edu> 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 <eeide@cs.utah.edu>  .         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 <eeide@cs.utah.edu>
To: Xsmith Dev Mailing List <xsmith-dev@flux.utah.edu>
Subject: Re: [xsmith-dev] xsmith-dev Digest, Vol 4, Issue 2
Message-ID: <m1imiuvf12.fsf@cs.utah.edu>
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 <eeide@cs.utah.edu>  .         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 <pmatos@linki.tools>
To: Xsmith Dev Mailing List <xsmith-dev@flux.utah.edu>
Subject: [xsmith-dev] Examples
Message-ID: <878sjp7qox.fsf@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
****************************************