llvm.org GIT mirror llvm / 37e8db6
Bring back r297624. The issues was just a missing REQUIRES in the test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297661 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 3 years ago
3 changed file(s) with 26 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
472472 // possible.
473473 if (!(Flags & sys::fs::F_Text))
474474 sys::ChangeStdoutToBinary();
475 return STDOUT_FILENO;
475 return dup(STDOUT_FILENO);
476476 }
477477
478478 int FD;
0 ; REQUIRES: default_triple
1
2 ; Often LLVM tools use "-" to indicate that output should be written to stdout
3 ; instead of a file. This behaviour is implemented by the raw_fd_ostream class.
4 ; This test verifies that when doing so multiple times we don't try to access a
5 ; closed STDOUT_FILENO. The exact options used in this test are unimportant, as
6 ; long as they write to stdout using raw_fd_ostream.
7 ; RUN: llc %s -o=- -pass-remarks-output=- -filetype=asm | FileCheck %s
8 ; foobar should appear as a function somewhere in the assembly file.
9 ; CHECK: foobar
10 ; !Analysis appears at the start of pass-remarks-output.
11 ; CHECK: !Analysis
12
13 define void @foobar() {
14 ret void
15 }
88
99 #include "gtest/gtest.h"
1010 #include "llvm/ADT/SmallString.h"
11 #include "llvm/Support/FileSystem.h"
1112 #include "llvm/Support/Format.h"
1213 #include "llvm/Support/raw_ostream.h"
1314
329330 "0007: 68 69 6a 6b 6c |hijkl|",
330331 format_bytes_with_ascii_str(B.take_front(12), 0, 7, 1));
331332 }
332 }
333
334 TEST(raw_fd_ostreamTest, multiple_raw_fd_ostream_to_stdout) {
335 std::error_code EC;
336
337 { raw_fd_ostream("-", EC, sys::fs::OpenFlags::F_None); }
338 { raw_fd_ostream("-", EC, sys::fs::OpenFlags::F_None); }
339 }
340 }