//===----------------------------------------------------------------------===//
#include "llvm/Support/Path.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FileUtilities.h"
+#include "llvm/Support/Host.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "gtest/gtest.h"
}
void TearDown() override { ASSERT_NO_ERROR(fs::remove(TestDirectory.str())); }
+
+ SmallVector<Triple::ArchType, 4> UnsupportedArchs;
+ SmallVector<Triple::OSType, 4> UnsupportedOSs;
+ SmallVector<Triple::EnvironmentType, 1> UnsupportedEnvironments;
+
+ bool isUnsupportedOSOrEnvironment() {
+ Triple Host(Triple::normalize(sys::getProcessTriple()));
+
+ if (find(UnsupportedEnvironments, Host.getEnvironment()) !=
+ UnsupportedEnvironments.end())
+ return true;
+
+ if (is_contained(UnsupportedOSs, Host.getOS()))
+ return true;
+
+ if (is_contained(UnsupportedArchs, Host.getArch()))
+ return true;
+
+ return false;
+ }
+
+ FileSystemTest() {
+ UnsupportedArchs.push_back(Triple::mips);
+ UnsupportedArchs.push_back(Triple::mipsel);
+ }
};
TEST_F(FileSystemTest, Unique) {
::close(FileDescriptor);
}
+#define CHECK_UNSUPPORTED() \
+ do { \
+ if (isUnsupportedOSOrEnvironment()) \
+ return; \
+ } while (0); \
+
TEST_F(FileSystemTest, is_local) {
+ CHECK_UNSUPPORTED();
+
SmallString<128> CurrentPath;
ASSERT_NO_ERROR(fs::current_path(CurrentPath));