Make all fstream tests use tmpnam if creating files, rather than
hard-coded names.
llvm-svn: 135444
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 7eb41cf..28e3c95 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 @@
}
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 @@
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 45b8f0a..a31f9a1 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 c287291..23795f0 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),