| // Copyright 2015 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // Test for verifying that the Go runtime properly forwards |
| // signals when non-Go signals are raised. |
| int main(int argc, char** argv) { |
| printf("Missing argument\n"); |
| printf("calling RunGoroutines\n"); |
| printf("attempting segfault\n"); |
| volatile int crash = *(int *) 0; |
| printf("attempting external signal test\n"); |
| // The program should be interrupted before |
| // this sleep finishes. We use select rather |
| // than sleep because in older versions of |
| // glibc the sleep function does some signal |
| // fiddling to handle SIGCHLD. If this |
| // program is fiddling signals just when the |
| // test program sends the signal, the signal |
| // may be delivered to a Go thread which will |
| select(0, NULL, NULL, NULL, &tv); |
| printf("Unknown test: %d\n", test); |