;;; (ptr: #<pointer 0x7f49bac0c000>) ;;; (addr 139954642534400) strace: Process 19807 attached ;;; (text "munmap(0x7f49c50d1000, 11) = 0\nmunmap(0x7f49c5078000, 10) = 0\n") ;;; (pattern "munmap(0x7f49bac0c000") ;;; (lines ("munmap(0x7f49c50d1000, 11) = 0" "munmap(0x7f49c5078000, 10) = 0" "")) test-name: manual munmap does not lead to double free location: /home/maxim/src/guix/tests/syscalls.scm:752 source: + (test-equal + "manual munmap does not lead to double free" + 1 + (begin + (define mmap-address #f) + (call-with-output-file + temp-file + (lambda (p) + (display "something interesting\n" p))) + (sync) + (system + (string-append + "strace -o " + strace-output + " -p " + (number->string (getpid)) + " -e trace=munmap &")) + (let* ((bv (file->bytevector temp-file)) + (address + (pk 'addr + (pointer-address + (pk 'ptr: (bytevector->pointer bv)))))) + (set! mmap-address address) + (munmap bv)) + (gc) + (sync) + (let ((text (pk 'text + (call-with-input-file + strace-output + get-string-all))) + (pattern + (pk 'pattern + (format #f "munmap(0x~x" mmap-address)))) + (length + (filter + (cut string-prefix-ci? pattern <>) + (pk 'lines (string-split text #\newline))))))) expected-value: 1 actual-value: 0 result: FAIL