diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2011-10-11 00:24:21 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2011-10-11 00:24:21 +0200 |
commit | 665f4c1f16ed24d3765e651d39dbb49cde3756e4 (patch) | |
tree | 99fe9ab48d6054d8e2bb5d949fc6bb16be820dca | |
parent | d58818f7ba00ea641030c0c68a427a59fc6253b3 (diff) | |
download | gcc-665f4c1f16ed24d3765e651d39dbb49cde3756e4.zip gcc-665f4c1f16ed24d3765e651d39dbb49cde3756e4.tar.gz gcc-665f4c1f16ed24d3765e651d39dbb49cde3756e4.tar.bz2 |
target-supports.exp (check_effective_target_fd_truncate): Close and unlink test file before exit.
* lib/target-supports.exp (check_effective_target_fd_truncate):
Close and unlink test file before exit.
From-SVN: r179774
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 17 |
2 files changed, 18 insertions, 4 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1be870b..314391b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-10-11 Uros Bizjak <ubizjak@gmail.com> + + * lib/target-supports.exp (check_effective_target_fd_truncate): + Close and unlink test file before exit. + 2011-10-10 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/50564 diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 550d534..a3b5311 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3739,16 +3739,25 @@ proc check_effective_target_fd_truncate { } { int fd; const char t[] = "test writing more than ten characters"; char s[11]; - fd = fileno (f); + int status = 0; + fd = fileno (f); write (fd, t, sizeof (t) - 1); lseek (fd, 0, 0); if (ftruncate (fd, 10) != 0) - exit (1); + status = 1; close (fd); + fclose (f); + if (status) + { + unlink ("tst.tmp"); + exit (status); + } f = fopen ("tst.tmp", "rb"); if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0) - exit (1); - exit (0); + status = 1; + fclose (f); + unlink ("tst.tmp"); + exit (status); } } |