summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psx13/test.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-01 17:24:35 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-01 17:24:35 +0000
commitc40d3c4b02ba66dbc99ad7fd01813e42f1b99c6a (patch)
treeb95b7430a0b275d59076817893ba2e35d9075581 /testsuites/psxtests/psx13/test.c
parent2010-07-01 Vinu Rajashekhar <vinutheraj@gmail.com> (diff)
downloadrtems-c40d3c4b02ba66dbc99ad7fd01813e42f1b99c6a.tar.bz2
2010-07-01 Vinu Rajashekhar <vinutheraj@gmail.com>
PR 1597/cpukit * psx13/psx13.scn, psx13/test.c, psxstat/psxstat.scn, psxstat/test.c: Add lchown() and utimes().
Diffstat (limited to '')
-rw-r--r--testsuites/psxtests/psx13/test.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/testsuites/psxtests/psx13/test.c b/testsuites/psxtests/psx13/test.c
index 3a4b9fe809..0f37b584b3 100644
--- a/testsuites/psxtests/psx13/test.c
+++ b/testsuites/psxtests/psx13/test.c
@@ -14,6 +14,7 @@
* pipe - test implemented
* umask - test implemented
* utime - test implemented
+ * utimes - test implemented
*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
@@ -44,6 +45,7 @@ int Dup2Test(void);
int FDataSyncTest(void);
int UMaskTest(void);
int UTimeTest(void);
+int UTimesTest(void);
int PipeTest(void);
int PipeTestNull(void);
int PathConfTest(void);
@@ -427,6 +429,66 @@ int UTimeTest (void)
}
/* ---------------------------------------------------------------
+ * UTimesTest function
+ *
+ * Hits the utimes code. Does NOT test the functionality of the underlying utime
+ * entry in the IMFS op table.
+ *
+ * arguments: none
+ * assumptions: utimes function available.
+ * actions: set utimes for an invalid filename.
+ * set utimes for a valid filename.
+ *
+ * returns: TRUE if time on valid file is set correctly and utimes failed on
+ * an invalid filename.
+ * FALSE otherwise.
+ *
+ * ---------------------------------------------------------------
+ */
+
+int UTimesTest (void)
+{
+ int error = 0, retval = FALSE;
+ struct timeval time[2];
+ struct stat fstat;
+
+ /* First, an invalid filename. */
+ error = utimes("!This is an =invalid p@thname!!! :)", NULL);
+
+ if (error == -1)
+ retval = TRUE;
+ else
+ retval = FALSE;
+
+ /* Now, the success test. */
+ if (retval == TRUE) {
+
+ time[0].tv_sec = 12345;
+ time[1].tv_sec = 54321;
+
+ error = utimes("testfile1.tst", &time);
+
+ if (error == 0) {
+
+ /* But, did it set the time? */
+ stat ("testfile1.tst", &fstat);
+
+ if ((fstat.st_atime == 12345) && (fstat.st_mtime == 54321 ))
+ retval = TRUE;
+ else
+ retval = FALSE;
+ }
+
+ else
+ retval = FALSE;
+ }
+
+ /* assert (retval == TRUE);*/
+
+ return (retval);
+}
+
+/* ---------------------------------------------------------------
* PipeTest function
*
* Hits the pipe code.
@@ -663,6 +725,12 @@ int main(
else
printf ("Failed!!!\n");
+ printf ("Testing utimes().......... ");
+ if (UTimesTest() == TRUE)
+ printf ("Success.\n");
+ else
+ printf ("Failed!!!\n");
+
printf ("Testing pipe()........... ");
if (PipeTest() == TRUE)
printf ("Success.\n");