[ocaml-ctypes] Spinning process on osx

Daniel Bünzli daniel.buenzli at erratique.ch
Tue Dec 17 05:41:12 GMT 2013


Le dimanche, 8 décembre 2013 à 00:37, Daniel Bünzli a écrit :
> Le samedi, 7 décembre 2013 à 23:48, Jeremy Yallop a écrit :
> > If the bug can be triggered by a script it'd be interesting to see the
> > results of running the script under 'git bisect' on the OCaml compiler
> > repository.
>  

Okay so here you have. First a few preliminaries.

  brew update && brew install sdl2
  opam repo add erratique-u http://erratique.ch/software/opam/unreleased
  opam update && opam install tsdl
  curl http://erratique.ch/tmp/tsdl_bug.ml > /tmp/tsdl_bug.ml

Then test that the bug exists on your machine. This assumes OCaml 4.01.0 is in your environment (and here I'm on osx 10.8.5 with xcode 5.0.2 which implies clang).

  cd /tmp/
  ocamlbuild -use-ocamlfind -tag "package(tsdl)" tsdl_bug.native
  ./tsdl_bug.native # black window pops up, runs forever, pizza of death
  killall -9 tsdl_bug.native # in another terminal

If the bug exists then with that setup you can use the following script, it builds and runs the issue. If the program spins it exits with 1 otherwise with 0. It assumes the built compilers are in the environment.  

#!/bin/sh
opam remove tsdl
opam install tsdl
cd /tmp/
ocamlbuild -clean  
ocamlbuild -use-ocamlfind -tag "package(tsdl)" tsdl_bug.native

(./tsdl_bug.native) & pid=$!
sleep 2
kill -9 $pid 2>/dev/null
if [ "$?" = "0" ]; then  
# Killed we were spinning.
exit 1
else
# Not killed we finished, no bug
exit 0
fi

Best,

Daniel

P.S. With 4.01.0 tsdl.cmx is a breeze to compile, on 4.00.1 it takes approx. 8 min on my machine. 


More information about the Ctypes mailing list