diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-10-17 14:54:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:21:19 -0500 |
commit | 8acb0575c716c8ca680835764cd3bc5483f3707c (patch) | |
tree | 615bf2db4d5bfd2262830e34082b34220503d0fb /source4/lib/replace/test/testsuite.c | |
parent | d60c86364c396adee36aa5d353aa782bbf26e01e (diff) | |
download | samba-8acb0575c716c8ca680835764cd3bc5483f3707c.tar.gz samba-8acb0575c716c8ca680835764cd3bc5483f3707c.tar.bz2 samba-8acb0575c716c8ca680835764cd3bc5483f3707c.zip |
r19373: Merge changes from subunit branch: Convert libreplace testsuite to a
standalone program that speaks subunit.
(This used to be commit 48d316e7594dfc29b8e6a710e32bb5a6a036b7cf)
Diffstat (limited to 'source4/lib/replace/test/testsuite.c')
-rw-r--r-- | source4/lib/replace/test/testsuite.c | 40 |
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 |