summaryrefslogtreecommitdiff
path: root/source4/lib/replace/test/testsuite.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/replace/test/testsuite.c')
-rw-r--r--source4/lib/replace/test/testsuite.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/source4/lib/replace/test/testsuite.c b/source4/lib/replace/test/testsuite.c
index d45304103f..3e20e22e45 100644
--- a/source4/lib/replace/test/testsuite.c
+++ b/source4/lib/replace/test/testsuite.c
@@ -57,26 +57,28 @@ static int test_ftruncate(void)
struct stat st;
int fd;
const int size = 1234;
- printf("testing ftruncate\n");
+ printf("test: ftruncate\n");
unlink(TESTFILE);
fd = open(TESTFILE, O_RDWR|O_CREAT, 0600);
if (fd == -1) {
- printf("creating '%s' failed - %s\n", TESTFILE, strerror(errno));
+ printf("failure: ftruncate [\n"
+ "creating '%s' failed - %s\n]\n", TESTFILE, strerror(errno));
return false;
}
if (ftruncate(fd, size) != 0) {
- printf("ftruncate failed - %s\n", strerror(errno));
+ printf("failure: ftruncate [\n%s\n]\n", strerror(errno));
return false;
}
if (fstat(fd, &st) != 0) {
- printf("fstat failed - %s\n", strerror(errno));
+ printf("failure: ftruncate [\nfstat failed - %s\n]\n", strerror(errno));
return false;
}
if (st.st_size != size) {
- printf("ftruncate gave wrong size %d - expected %d\n",
+ printf("failure: ftruncate [\ngave wrong size %d - expected %d\n]\n",
(int)st.st_size, size);
return false;
}
+ printf("success: ftruncate\n");
return true;
}
@@ -98,13 +100,14 @@ static int test_strlcpy(void)
{ NULL, 0 }
};
int i;
- printf("testing strlcpy\n");
+ printf("test: strlcpy\n");
for (i=0;tests[i].src;i++) {
if (strlcpy(buf, tests[i].src, sizeof(buf)) != tests[i].result) {
- printf("strlcpy test %d failed\n", i);
+ printf("failure: strlcpy [\ntest %d failed\n]\n", i);
return false;
}
}
+ printf("success: strlcpy\n");
return true;
}
@@ -146,8 +149,9 @@ static int test_strdup(void)
static int test_setlinebuf(void)
{
- printf("testing setlinebuf\n");
+ printf("test: setlinebuf\n");
setlinebuf(stdout);
+ printf("success: setlinebuf\n");
return true;
}
@@ -233,10 +237,11 @@ extern int test_readdir_os2_delete(void);
static int test_readdir(void)
{
- printf("testing readdir\n");
+ printf("test: readdir\n");
if (test_readdir_os2_delete() != 0) {
return false;
}
+ printf("success: readdir\n");
return true;
}
@@ -373,7 +378,7 @@ static int test_MAX(void)
struct torture_context;
-bool torture_local_replace(struct torture_context *torture)
+int main()
{
bool ret = true;
ret &= test_ftruncate();
@@ -420,16 +425,7 @@ bool torture_local_replace(struct torture_context *torture)
ret &= test_MIN();
ret &= test_MAX();
- return ret;
+ if (ret)
+ return 0;
+ return -1;
}
-
-#if _SAMBA_BUILD_<4
-int main(void)
-{
- if (!torture_local_replace(NULL)) {
- printf("ERROR: TESTSUITE FAILED\n");
- return -1;
- }
- return 0;
-}
-#endif