YARN-8518. test-container-executor test_is_empty() is broken (Jim_Brennan via rkanter)
This commit is contained in:
parent
556d9b36be
commit
1bc106a738
|
@ -1203,19 +1203,23 @@ void test_trim_function() {
|
||||||
free(trimmed);
|
free(trimmed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int is_empty(char *name);
|
||||||
|
|
||||||
void test_is_empty() {
|
void test_is_empty() {
|
||||||
printf("\nTesting is_empty function\n");
|
printf("\nTesting is_empty function\n");
|
||||||
if (is_empty("/")) {
|
if (is_empty("/")) {
|
||||||
printf("FAIL: / should not be empty\n");
|
printf("FAIL: / should not be empty\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (is_empty("/tmp/2938rf2983hcqnw8ud/noexist")) {
|
char *noexist = TEST_ROOT "/noexist";
|
||||||
printf("FAIL: /tmp/2938rf2983hcqnw8ud/noexist should not exist\n");
|
if (is_empty(noexist)) {
|
||||||
|
printf("%s should not exist\n", noexist);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
mkdir("/tmp/2938rf2983hcqnw8ud/emptydir", S_IRWXU);
|
char *emptydir = TEST_ROOT "/emptydir";
|
||||||
if (!is_empty("/tmp/2938rf2983hcqnw8ud/emptydir")) {
|
mkdir(emptydir, S_IRWXU);
|
||||||
printf("FAIL: /tmp/2938rf2983hcqnw8ud/emptydir be empty\n");
|
if (!is_empty(emptydir)) {
|
||||||
|
printf("FAIL: %s should be empty\n", emptydir);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue