Fix make-array transforms.
[sbcl.git] / tests / threads.test.sh
1 #!/bin/sh
2
3 # This software is part of the SBCL system. See the README file for
4 # more information.
5 #
6 # While most of SBCL is derived from the CMU CL system, the test
7 # files (like this one) were written from scratch after the fork
8 # from CMU CL.
9 #
10 # This software is in the public domain and is provided with
11 # absolutely no warranty. See the COPYING and CREDITS files for
12 # more information.
13
14 . ./subr.sh
15 use_test_subdirectory
16
17 run_sbcl --eval '(sb-thread:return-from-thread t :allow-exit t)'
18 check_status_maybe_lose "return from main thread" $? 0 "ok"
19
20 run_sbcl --eval '(sb-thread:abort-thread :allow-exit t)'
21 check_status_maybe_lose "abort main thread" $? 1 "ok"
22
23 run_sbcl --eval '#+sb-thread (sb-thread:join-thread (sb-thread:make-thread (lambda () (sb-ext:exit :code 77)))) #-sb-thread (sb-ext:exit :code 77)'
24 check_status_maybe_lose "exit from normal thread" $? 77 "ok"
25
26 flag="condition-wait-sigcont.tmp"
27 touch $flag
28
29 # $! is not set correctly when calling run_sbcl, do it directly
30 "$SBCL_RUNTIME" --core "$SBCL_CORE" $SBCL_ARGS \
31     --load "$SBCL_PWD/condition-wait-sigcont.lisp" &
32 sb_pid=$!
33
34 while [ -f $flag ]; do sleep 1; done
35 sleep 1
36 kill -STOP $sb_pid
37 kill -CONT $sb_pid
38
39 sleep 2
40 kill -KILL $sb_pid
41
42 if [ -f $flag ]
43 then
44     rm $flag
45     exit 1 # error
46 else
47     exit 104 # success
48 fi