Fix some tests. Remove all externs to Tst_count.
Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
diff --git a/testcases/kernel/syscalls/fsync/fsync01.c b/testcases/kernel/syscalls/fsync/fsync01.c
index 830fa48..c792f78 100644
--- a/testcases/kernel/syscalls/fsync/fsync01.c
+++ b/testcases/kernel/syscalls/fsync/fsync01.c
@@ -123,7 +123,6 @@
char *TCID = "fsync01"; /* Test program identifier. */
int TST_TOTAL = 1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
int exp_enos[] = { 0, 0 };
@@ -136,67 +135,36 @@
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
- /***************************************************************
- * parse standard options
- ***************************************************************/
if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
setup();
- /* set the expected errnos... */
TEST_EXP_ENOS(exp_enos);
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
for (lc = 0; TEST_LOOPING(lc); lc++) {
Tst_count = 0;
- /* write sone data to get fsync'd out */
- if (write(fd, &buf, strlen(buf)) == -1) {
- tst_brkm(TBROK, cleanup,
- "write(%s, &buf, strlen(buf)) Failed, errno=%d : %s",
- fname, TEST_ERRNO, strerror(TEST_ERRNO));
- }
- /*
- * Call fsync(2)
- */
+ if (write(fd, &buf, strlen(buf)) == -1)
+ tst_brkm(TBROK|TERRNO, cleanup, "write failed");
TEST(fsync(fd));
- /* check return code */
- if (TEST_RETURN == -1) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fsync(%s) Failed, errno=%d : %s",
- fname, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if (STD_FUNCTIONAL_TEST) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "fsync(%s) returned %ld", fname,
- TEST_RETURN);
- }
+ if (TEST_RETURN == -1)
+ tst_resm(TFAIL|TTERRNO, "fsync failed");
+ else {
+ if (STD_FUNCTIONAL_TEST)
+ tst_resm(TPASS, "fsync returned %ld", fname,
+ TEST_RETURN);
}
}
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
cleanup();
+ tst_exit();
}
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
void setup()
{
@@ -207,31 +175,17 @@
tst_tmpdir();
sprintf(fname, "tfile_%d", getpid());
- if ((fd = open(fname, O_RDWR | O_CREAT, 0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
+ if ((fd = open(fname, O_RDWR|O_CREAT, 0700)) == -1)
+ tst_brkm(TBROK|TERRNO, cleanup, "open failed");
}
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
void cleanup()
{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
TEST_CLEANUP;
- /* close the file we have open */
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno,
- strerror(errno));
- }
+ if (close(fd) == -1)
+ tst_resm(TWARN, "close failed");
tst_rmdir();
-}
\ No newline at end of file
+}