repair some tests
A recent test for `_bytes` had a memory bug. An old test for weak hash tables had a race between GC and hash-table lookup.
This commit is contained in:
parent
62b8ca3ca7
commit
e2e469240f
|
@ -2270,15 +2270,18 @@
|
|||
(for/list ([j 4])
|
||||
(thread
|
||||
(lambda ()
|
||||
(define save-keys '())
|
||||
(for ([i 1000])
|
||||
(define v (random 100000))
|
||||
(define k (a v))
|
||||
(set! save-keys (cons k save-keys))
|
||||
(hash-set! cht k v)
|
||||
;; Make sure the addition didn't get lost, which
|
||||
;; can happen when a lock is missing:
|
||||
(unless (equal? (hash-ref cht k #f) v)
|
||||
(error "oops")))
|
||||
(semaphore-post done)))))
|
||||
(semaphore-post done)
|
||||
save-keys))))
|
||||
|
||||
(for-each sync ths)
|
||||
|
||||
|
|
|
@ -533,10 +533,14 @@
|
|||
(test 107 ptr-ref v _intptr))
|
||||
|
||||
;; Test _bytes and _bytes/nul-terminated
|
||||
(let ([p (malloc 8)])
|
||||
(memcpy p #"hi, all\0" 8)
|
||||
(test #"hi, all" cast p _pointer _bytes)
|
||||
(test #"hi, all" cast p _pointer _bytes/nul-terminated))
|
||||
(let ([p (malloc 8)])
|
||||
(memcpy p #"hi, all!" 8)
|
||||
(test #"hi, all!" cast p _pointer _bytes)
|
||||
(test #"hi, all!" cast p _pointer _bytes/nul-terminated))
|
||||
(test #"hi, all!" cast p _pointer (_bytes o 8))
|
||||
(test #"hi, all!" cast p _pointer (_bytes/nul-terminated o 8)))
|
||||
(let* ([strdup (get-ffi-obj 'strdup #f (_fun _bytes/nul-terminated -> _pointer))]
|
||||
[p (strdup #"howdy...")])
|
||||
(test #"howdy..." cast p _pointer _bytes)
|
||||
|
|
Loading…
Reference in New Issue
Block a user