summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorAlexis Hunt <alercah@gmail.com>2011-07-18 23:51:21 +0000
committerAlexis Hunt <alercah@gmail.com>2011-07-18 23:51:21 +0000
commit483cf2454756d623ea202c8ae733d9a954b9a8d7 (patch)
treebc242419f5b4c7a9918ae4f2029fb30694de2ed6 /libcxx
parent353404d924602c1af78315114e67328036d26f94 (diff)
downloadbcm5719-llvm-483cf2454756d623ea202c8ae733d9a954b9a8d7.tar.gz
bcm5719-llvm-483cf2454756d623ea202c8ae733d9a954b9a8d7.zip
Make all fstream tests use tmpnam if creating files, rather than
hard-coded names. llvm-svn: 135444
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp27
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp13
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp27
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp12
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp2
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp10
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp27
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp27
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp10
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp14
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp10
24 files changed, 205 insertions, 156 deletions
diff --git a/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp
index da47daaea8a..10aa05d4524 100644
--- a/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp
@@ -19,10 +19,12 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -33,11 +35,11 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
- remove("test.dat");
+ remove(temp);
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -48,5 +50,5 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
- remove("test.dat");
+ remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp
index 0b646f84d18..739f99480c1 100644
--- a/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp
@@ -20,10 +20,12 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -34,11 +36,11 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
- remove("test.dat");
+ remove(temp);
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -49,6 +51,6 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
- remove("test.dat");
+ remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp
index 84060337ff4..9a9b28ce483 100644
--- a/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp
@@ -21,10 +21,12 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -35,11 +37,11 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
- remove("test.dat");
+ remove(temp);
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -50,5 +52,5 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
- remove("test.dat");
+ remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp
index 77e50587ba7..352a980913c 100644
--- a/libcxx/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp
@@ -20,10 +20,12 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -33,11 +35,11 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
- remove("test.dat");
+ remove(temp);
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -47,6 +49,6 @@ int main()
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
- remove("test.dat");
+ remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
index b685c660fe7..192e65f55ff 100644
--- a/libcxx/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
@@ -16,34 +16,36 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::out) != 0);
+ assert(f.open(temp, std::ios_base::out) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
}
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::in) != 0);
+ assert(f.open(temp, std::ios_base::in) != 0);
assert(f.is_open());
assert(f.sbumpc() == '1');
assert(f.sbumpc() == '2');
assert(f.sbumpc() == '3');
}
- remove("test.dat");
+ remove(temp);
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::out) != 0);
+ assert(f.open(temp, std::ios_base::out) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
}
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::in) != 0);
+ assert(f.open(temp, std::ios_base::in) != 0);
assert(f.is_open());
assert(f.sbumpc() == L'1');
assert(f.sbumpc() == L'2');
assert(f.sbumpc() == L'3');
}
- remove("test.dat");
+ remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp
index e717cc5c031..4cae835ea50 100644
--- a/libcxx/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp
@@ -19,11 +19,14 @@
int main()
{
+ char temp1[L_tmpnam], temp2[L_tmpnam];
+ tmpnam(temp1);
+ tmpnam(temp2);
{
- std::fstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- std::fstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::fstream fs1(temp1, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::fstream fs2(temp2, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -40,13 +43,13 @@ int main()
fs2 >> i;
assert(i == 2);
}
- std::remove("test1.dat");
- std::remove("test2.dat");
+ std::remove(temp1);
+ std::remove(temp2);
{
- std::wfstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- std::wfstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::wfstream fs1(temp1, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::wfstream fs2(temp2, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -63,6 +66,6 @@ int main()
fs2 >> i;
assert(i == 2);
}
- std::remove("test1.dat");
- std::remove("test2.dat");
+ std::remove(temp1);
+ std::remove(temp2);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp
index 9504aeae303..09b4f7460d7 100644
--- a/libcxx/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp
@@ -20,9 +20,10 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
{
- std::fstream fso("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::fstream fso(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
std::fstream fs;
fs = move(fso);
double x = 0;
@@ -31,10 +32,10 @@ int main()
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
{
- std::wfstream fso("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
std::wfstream fs;
fs = move(fso);
double x = 0;
@@ -43,6 +44,6 @@ int main()
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp
index 0cc43ca14b7..27ee8427f5a 100644
--- a/libcxx/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp
@@ -20,11 +20,14 @@
int main()
{
+ char temp1[L_tmpnam], temp2[L_tmpnam];
+ tmpnam(temp1);
+ tmpnam(temp2);
{
- std::fstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- std::fstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::fstream fs1(temp1, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::fstream fs2(temp2, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -41,13 +44,13 @@ int main()
fs2 >> i;
assert(i == 2);
}
- std::remove("test1.dat");
- std::remove("test2.dat");
+ std::remove(temp1);
+ std::remove(temp2);
{
- std::wfstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- std::wfstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::wfstream fs1(temp1, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::wfstream fs2(temp2, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -64,6 +67,6 @@ int main()
fs2 >> i;
assert(i == 2);
}
- std::remove("test1.dat");
- std::remove("test2.dat");
+ std::remove(temp1);
+ std::remove(temp2);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp
index 7eb41cf2bb3..28e3c95d4b2 100644
--- a/libcxx/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp
@@ -20,9 +20,11 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::fstream fso("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::fstream fso(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
std::fstream fs = move(fso);
double x = 0;
fs << 3.25;
@@ -32,8 +34,8 @@ int main()
}
std::remove("test.dat");
{
- std::wfstream fso("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
std::wfstream fs = move(fso);
double x = 0;
fs << 3.25;
@@ -41,6 +43,6 @@ int main()
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
index 45b8f0a1ff8..a31f9a1d543 100644
--- a/libcxx/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
@@ -19,24 +19,26 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::fstream fs("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::fstream fs(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
double x = 0;
fs << 3.25;
fs.seekg(0);
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
{
- std::wfstream fs("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::wfstream fs(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
double x = 0;
fs << 3.25;
fs.seekg(0);
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
index c2872913f9f..23795f010a5 100644
--- a/libcxx/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
@@ -19,7 +19,7 @@
int main()
{
- char temp [L_tmpnam];
+ char temp[L_tmpnam];
tmpnam(temp);
{
std::fstream fs(std::string(temp),
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp
index 1aa37dfa4d5..94b91806f81 100644
--- a/libcxx/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp
@@ -19,22 +19,24 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::fstream fs;
assert(!fs.is_open());
- fs.open("test.dat", std::ios_base::out);
+ fs.open(temp, std::ios_base::out);
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
- remove("test.dat");
+ remove(temp);
{
std::wfstream fs;
assert(!fs.is_open());
- fs.open("test.dat", std::ios_base::out);
+ fs.open(temp, std::ios_base::out);
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
- remove("test.dat");
+ remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
index 4d291ef6e53..64c4de9dfe7 100644
--- a/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
@@ -19,11 +19,13 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::fstream fs;
assert(!fs.is_open());
- fs.open("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ fs.open(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
fs << 3.25;
@@ -31,12 +33,12 @@ int main()
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
{
std::wfstream fs;
assert(!fs.is_open());
- fs.open("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ fs.open(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
fs << 3.25;
@@ -44,5 +46,5 @@ int main()
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
index a8e871b59bd..a61a4e965d3 100644
--- a/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
@@ -19,11 +19,13 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::fstream fs;
assert(!fs.is_open());
- fs.open(std::string("test.dat"), std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ fs.open(std::string(temp), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
fs << 3.25;
@@ -31,12 +33,12 @@ int main()
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
{
std::wfstream fs;
assert(!fs.is_open());
- fs.open(std::string("test.dat"), std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ fs.open(std::string(temp), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
fs << 3.25;
@@ -44,5 +46,5 @@ int main()
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp
index 1f3f457fb73..7800c1abe8b 100644
--- a/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp
@@ -19,9 +19,12 @@
int main()
{
+ char temp1[L_tmpnam], temp2[L_tmpnam];
+ tmpnam(temp1);
+ tmpnam(temp2);
{
- std::ofstream fs1("test1.dat");
- std::ofstream fs2("test2.dat");
+ std::ofstream fs1(temp1);
+ std::ofstream fs2(temp2);
fs1 << 3.25;
fs2 << 4.5;
fs1.swap(fs2);
@@ -29,26 +32,26 @@ int main()
fs2 << ' ' << 4.5;
}
{
- std::ifstream fs("test1.dat");
+ std::ifstream fs(temp1);
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
- remove("test1.dat");
+ remove(temp1);
{
- std::ifstream fs("test2.dat");
+ std::ifstream fs(temp2);
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
- remove("test2.dat");
+ remove(temp2);
{
- std::wofstream fs1("test1.dat");
- std::wofstream fs2("test2.dat");
+ std::wofstream fs1(temp1);
+ std::wofstream fs2(temp2);
fs1 << 3.25;
fs2 << 4.5;
fs1.swap(fs2);
@@ -56,21 +59,21 @@ int main()
fs2 << ' ' << 4.5;
}
{
- std::wifstream fs("test1.dat");
+ std::wifstream fs(temp1);
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
- remove("test1.dat");
+ remove(temp1);
{
- std::wifstream fs("test2.dat");
+ std::wifstream fs(temp2);
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
- remove("test2.dat");
+ remove(temp2);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp
index 55aa3a2084a..7f80cfcc512 100644
--- a/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp
@@ -20,31 +20,33 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::ofstream fso("test.dat");
+ std::ofstream fso(temp);
std::ofstream fs;
fs = move(fso);
fs << 3.25;
}
{
- std::ifstream fs("test.dat");
+ std::ifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
{
- std::wofstream fso("test.dat");
+ std::wofstream fso(temp);
std::wofstream fs;
fs = move(fso);
fs << 3.25;
}
{
- std::wifstream fs("test.dat");
+ std::wifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
index 8834cf39c62..24deafdcf5c 100644
--- a/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
@@ -20,9 +20,12 @@
int main()
{
+ char temp1[L_tmpnam], temp2[L_tmpnam];
+ tmpnam(temp1);
+ tmpnam(temp2);
{
- std::ofstream fs1("test1.dat");
- std::ofstream fs2("test2.dat");
+ std::ofstream fs1(temp1);
+ std::ofstream fs2(temp2);
fs1 << 3.25;
fs2 << 4.5;
swap(fs1, fs2);
@@ -30,26 +33,26 @@ int main()
fs2 << ' ' << 4.5;
}
{
- std::ifstream fs("test1.dat");
+ std::ifstream fs(temp1);
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
- remove("test1.dat");
+ remove(temp1);
{
- std::ifstream fs("test2.dat");
+ std::ifstream fs(temp2);
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
- remove("test2.dat");
+ remove(temp2);
{
- std::wofstream fs1("test1.dat");
- std::wofstream fs2("test2.dat");
+ std::wofstream fs1(temp1);
+ std::wofstream fs2(temp2);
fs1 << 3.25;
fs2 << 4.5;
swap(fs1, fs2);
@@ -57,21 +60,21 @@ int main()
fs2 << ' ' << 4.5;
}
{
- std::wifstream fs("test1.dat");
+ std::wifstream fs(temp1);
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
- remove("test1.dat");
+ remove(temp1);
{
- std::wifstream fs("test2.dat");
+ std::wifstream fs(temp2);
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
- remove("test2.dat");
+ remove(temp2);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp
index e230c706540..93bea0e486e 100644
--- a/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp
@@ -20,29 +20,31 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::ofstream fso("test.dat");
+ std::ofstream fso(temp);
std::ofstream fs = move(fso);
fs << 3.25;
}
{
- std::ifstream fs("test.dat");
+ std::ifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
{
- std::wofstream fso("test.dat");
+ std::wofstream fso(temp);
std::wofstream fs = move(fso);
fs << 3.25;
}
{
- std::wifstream fs("test.dat");
+ std::wifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
index 044fdc8cd31..7d899e776bb 100644
--- a/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
@@ -19,26 +19,28 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::ofstream fs("test.dat");
+ std::ofstream fs(temp);
fs << 3.25;
}
{
- std::ifstream fs("test.dat");
+ std::ifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
{
- std::wofstream fs("test.dat");
+ std::wofstream fs(temp);
fs << 3.25;
}
{
- std::wifstream fs("test.dat");
+ std::wifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
index 2f1335d29f1..67dd02aebb0 100644
--- a/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
@@ -19,26 +19,28 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::ofstream fs(std::string("test.dat"));
+ std::ofstream fs((std::string(temp)));
fs << 3.25;
}
{
- std::ifstream fs(std::string("test.dat"));
+ std::ifstream fs((std::string(temp)));
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
{
- std::wofstream fs(std::string("test.dat"));
+ std::wofstream fs((std::string(temp)));
fs << 3.25;
}
{
- std::wifstream fs(std::string("test.dat"));
+ std::wifstream fs((std::string(temp)));
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp
index eb58c1aec40..ad3f3783cee 100644
--- a/libcxx/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp
@@ -19,22 +19,24 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::ofstream fs;
assert(!fs.is_open());
- fs.open("test.dat");
+ fs.open(temp);
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
- remove("test.dat");
+ remove(temp);
{
std::wofstream fs;
assert(!fs.is_open());
- fs.open("test.dat");
+ fs.open(temp);
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
- remove("test.dat");
+ remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
index 6908559cd0c..bf8e6a5ca2f 100644
--- a/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
@@ -19,38 +19,40 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::ofstream fs;
assert(!fs.is_open());
char c = 'a';
fs << c;
assert(fs.fail());
- fs.open("test.dat");
+ fs.open(temp);
assert(fs.is_open());
fs << c;
}
{
- std::ifstream fs("test.dat");
+ std::ifstream fs(temp);
char c = 0;
fs >> c;
assert(c == 'a');
}
- remove("test.dat");
+ remove(temp);
{
std::wofstream fs;
assert(!fs.is_open());
wchar_t c = L'a';
fs << c;
assert(fs.fail());
- fs.open("test.dat");
+ fs.open(temp);
assert(fs.is_open());
fs << c;
}
{
- std::wifstream fs("test.dat");
+ std::wifstream fs(temp);
wchar_t c = 0;
fs >> c;
assert(c == L'a');
}
- remove("test.dat");
+ remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp
index 6687a400464..b33114d9725 100644
--- a/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp
@@ -19,38 +19,40 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::ofstream fs;
assert(!fs.is_open());
char c = 'a';
fs << c;
assert(fs.fail());
- fs.open(std::string("test.dat"));
+ fs.open(std::string(temp));
assert(fs.is_open());
fs << c;
}
{
- std::ifstream fs("test.dat");
+ std::ifstream fs(temp);
char c = 0;
fs >> c;
assert(c == 'a');
}
- remove("test.dat");
+ remove(temp);
{
std::wofstream fs;
assert(!fs.is_open());
wchar_t c = L'a';
fs << c;
assert(fs.fail());
- fs.open(std::string("test.dat"));
+ fs.open(std::string(temp));
assert(fs.is_open());
fs << c;
}
{
- std::wifstream fs("test.dat");
+ std::wifstream fs(temp);
wchar_t c = 0;
fs >> c;
assert(c == L'a');
}
- remove("test.dat");
+ remove(temp);
}
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp
index 436344daa08..8860c9ae92c 100644
--- a/libcxx/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp
@@ -19,16 +19,18 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::ofstream fs("test.dat");
+ std::ofstream fs(temp);
std::filebuf* fb = fs.rdbuf();
assert(fb->sputc('r') == 'r');
}
- remove("test.dat");
+ remove(temp);
{
- std::wofstream fs("test.dat");
+ std::wofstream fs(temp);
std::wfilebuf* fb = fs.rdbuf();
assert(fb->sputc(L'r') == L'r');
}
- remove("test.dat");
+ remove(temp);
}
OpenPOWER on IntegriCloud