aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg
diff options
context:
space:
mode:
authorVadim Godunko <godunko@adacore.com>2019-09-18 08:32:14 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-09-18 08:32:14 +0000
commit209a0094c4b1a8603b73beb77f28ea6c314d5875 (patch)
tree890a80dff58179628c4d5596de07ec29b59c6ac7 /gcc/testsuite/gnat.dg
parent82fa20a21141a1394d7188b21eb9c486ab16f8ea (diff)
downloadgcc-209a0094c4b1a8603b73beb77f28ea6c314d5875.zip
gcc-209a0094c4b1a8603b73beb77f28ea6c314d5875.tar.gz
gcc-209a0094c4b1a8603b73beb77f28ea6c314d5875.tar.bz2
[Ada] Raise exception on call to Expect for a dead process
Call to Expect for a dead process results in SIGBUS signal on Linux systems. Process_Died exception is raised in this case now. 2019-09-18 Vadim Godunko <godunko@adacore.com> gcc/ada/ * libgnat/g-expect.adb (Expect_Internal): Don't include invalid file descriptors into the set of file descriptors for Poll. Raise Process_Died exception when computed set of file descriptors to monitor is empty. gcc/testsuite/ * gnat.dg/expect4.adb: New testcase. From-SVN: r275847
Diffstat (limited to 'gcc/testsuite/gnat.dg')
-rw-r--r--gcc/testsuite/gnat.dg/expect4.adb35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/expect4.adb b/gcc/testsuite/gnat.dg/expect4.adb
new file mode 100644
index 0000000..7a974cc
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/expect4.adb
@@ -0,0 +1,35 @@
+-- { dg-do run }
+
+with GNAT.Expect.TTY;
+with GNAT.OS_Lib;
+
+procedure Expect4 is
+ Pid : GNAT.Expect.TTY.TTY_Process_Descriptor;
+ Args : GNAT.OS_Lib.Argument_List (1 .. 0);
+ Result : GNAT.Expect.Expect_Match;
+
+begin
+ Pid.Non_Blocking_Spawn ("true", Args);
+
+ begin
+ Pid.Expect (Result, ".*");
+
+ raise Program_Error;
+
+ exception
+ when GNAT.Expect.Process_Died =>
+ null;
+ end;
+
+ begin
+ Pid.Expect (Result, ".*");
+
+ raise Program_Error;
+
+ exception
+ when GNAT.Expect.Process_Died =>
+ null;
+ end;
+
+ Pid.Close;
+end Expect4; \ No newline at end of file