Split getcwd tests into two files as Windows cannot pass one of the tests.
This commit is contained in:
parent
0a995d8b3d
commit
4b6ae92419
@ -8,34 +8,17 @@
|
||||
|
||||
// Test runing a file in the same directory `cling CurrentDir.C`
|
||||
// More info in CIFactory.cpp createCIImpl (line ~850)
|
||||
|
||||
// RUN: cd %S && %cling -Xclang -verify CurrentDir.C 2>&1 | FileCheck %s
|
||||
// RUN: mkdir %T/Remove && cd %T/Remove && rm -rf %T/Remove && %cling -DTEST_CWDRETURN %s -Xclang -verify 2>&1 | FileCheck --check-prefix CHECK --check-prefix CHECKcwd %s
|
||||
// Test testCurrentDir
|
||||
|
||||
extern "C" {
|
||||
int printf(const char*, ...);
|
||||
char* getcwd(char *buf, std::size_t size);
|
||||
}
|
||||
|
||||
#ifdef TEST_CWDRETURN
|
||||
// Make sure include still works
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#endif
|
||||
// Make sure include still works
|
||||
#include <vector>
|
||||
|
||||
void CurrentDir() {
|
||||
#ifdef TEST_CWDRETURN
|
||||
char thisDir[1024];
|
||||
const char *rslt = getcwd(thisDir, sizeof(thisDir));
|
||||
// Make sure cling reported the error
|
||||
// CHECKcwd: Could not get current working directory: {{.*}}
|
||||
|
||||
if (rslt)
|
||||
printf("Working directory exists\n");
|
||||
// CHECK-NOT: Working directory exists
|
||||
#endif
|
||||
|
||||
printf("Script ran\n");
|
||||
// CHECK: Script ran
|
||||
}
|
||||
|
36
test/Driver/CurrentDirRm.C
Normal file
36
test/Driver/CurrentDirRm.C
Normal file
@ -0,0 +1,36 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// CLING - the C++ LLVM-based InterpreterG :)
|
||||
//
|
||||
// This file is dual-licensed: you can choose to license it under the University
|
||||
// of Illinois Open Source License or the GNU Lesser General Public License. See
|
||||
// LICENSE.TXT for details.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Removing the cwd on Unix works but on Windows cannot be done.
|
||||
// RUN: mkdir -p %T/Remove && cd %T/Remove && rm -rf %T/Remove && %cling %s -Xclang -verify 2>&1 | FileCheck %s
|
||||
// REQUIRES: not_system-windows
|
||||
|
||||
extern "C" {
|
||||
int printf(const char*, ...);
|
||||
char* getcwd(char *buf, std::size_t size);
|
||||
}
|
||||
|
||||
// Make sure include still works
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
|
||||
void CurrentDirRm() {
|
||||
char thisDir[1024];
|
||||
const char *rslt = getcwd(thisDir, sizeof(thisDir));
|
||||
// Make sure cling reported the error
|
||||
// CHECK: Could not get current working directory: {{.*}}
|
||||
|
||||
if (rslt)
|
||||
printf("Working directory exists\n");
|
||||
// CHECK-NOT: Working directory exists
|
||||
|
||||
printf("Script ran\n");
|
||||
// CHECK: Script ran
|
||||
}
|
||||
|
||||
//expected-no-diagnostics
|
Loading…
Reference in New Issue
Block a user