IRC channel logs

2024-02-22.log

back to list of logs

<old>So I have this idea of making an API fuzzing in Scheme to test my library. The idea is to define a set of procedures (foreign) that can be call and possible value for their parameters
<old>The fuzzing would be smart, in that it knows which procedures cna be called (for example you can not call anything before initilization)
<old>and it would know if some parameters come from an invalid pool, then it should return some error but if coming from a valid pool then not
<old>pools of parameter are mutated when calling procedure themself
<old>idk if this make sens, but I if yes, maybe it already exist ?
<rlb>old: not sure if it's useful to you, but wrt some precedents, there's erlang/haskell's quickcheck, and then inspired by that https://clojure.org/guides/test_check_beginner
<rlb>You write (type-related) generators, etc. and then it runs generative tests, attempting to narrow down failures to more minimal examples, etc.
<old>right I did use somthing like that, I think it is called guile-quickcheck
<old>but my idea is to augment the set of generators during execution
<old>and validate the API returned value
<old>for example, you call malloc and the pointer is added to the set of valid pointers that can be "generated" and passed to free
<old>hmm I see they have gen/bind
<old>which is kind of what I want
<old>interestring
<old>dthompson: this is a nice thing to have for optization (the talk we had about floating point arithmetic): https://srfi.schemers.org/srfi-145/srfi-145.html
<old>there is a trick similar in C where assert(COND) can be transformed into: while (!(COND)) __builtin_unreachable()
<old>which help the compiler optimize things by given it assumption
<dthompson>old: I wasn't aware of this srfi but this pattern is common for optimizing guile code
<Arsen>ACTION doesn't find asserts implying optimization very tricky
<Arsen>asserts are super nice.. i use them all the time to state assumptions and validate them during development and testin
<dthompson>yeah I have my own 'assert' syntax
<dthompson>guile's type inference pass will use the predicates that guard conditionals to optimize the resulting bytecode
<old>okay so the compiler is smart enough to do that arleady
<dthompson>for numeric stuff, one good trick is do (unless (real? x) (error "expected real" x)) when complex numbers aren't relevant
<old>say my entry point is procedure A, I do a single predicate there and dispatch to B. From there, all procedures that B called can be optimized assuming the predicated in A
<old>that will be the best scenario
<dthompson>there have been some type inference improvements since guile 3.0.9. a build from main will optimize some additinal things.
<old>nice
<old>ACTION eagerly waiting for blog post
<dthompson>hehe, one day...
<dthompson>it's not going to world changing or anything, but it will hopefully just get useful tips out there
<dthompson>to be world changing*