Currently, aio02 test case has the following problems:
1. Doesn't follow up ltp test case specification.
2. To run the command "runfstests.sh -a cases/aio_tio" will enter an
infinite loop.
3. Among of 8 cases, two are failed, including io_fsync and
io_fdsync,
they aren't supported by any filesystem currently, it should tell
the user explicitly
but not fail.
4. There are many duplicate code and bad source files layout.
This patch fixes all the above issues.
diff -purN a/testcases/kernel/io/aio/aio02/aio02.c b/testcases/kernel/io/aio/aio02/aio02.c
--- a/testcases/kernel/io/aio/aio02/aio02.c 1970-01-01 08:00:00.000000000 +0800
+++ b/testcases/kernel/io/aio/aio02/aio02.c 2006-08-17 16:12:53.194200189 +0800
@@ -0,0 +1,392 @@
+/*************************************************************************************
+*
+* Copyright (c) International Business Machines Corp., 2006
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+* the GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation,
+*
+* FILE : aio02.c
+*
+* USAGE: <for command-line>
+* aio02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+* where, -c n : Run n copies concurrently.
+* -e : Turn on errno logging.
+* -i n : Execute test n times.
+* -I x : Execute test for x seconds.
+* -P x : Pause for x seconds between iterations.
+* -t : Turn on syscall timing.
+*
+* DESCRIPTION : This program will test Asynchronous I/O in Linux 2.5 or up kernel
+* REQUIREMENTS:
+* 1) libaio-0.3.92 or up for 2.5 or up kernal
+* 2) glibc 2.1.91 or up
+* HISTORY :
+* 11/03/2003 Kai Zhao (ltcd3@...)
+*
+* 08/17/2006 Fix io_fsync failure and refactor code
+* by Yi Yang <yyangcdl@...>
+*
+* CODE COVERAGE:
+* 68.3% - fs/aio.c
+*
+************************************************************************************/
+
+#define _GNU_SOURCE
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/param.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/select.h>
+#include <libaio.h>
+#include <sys/uio.h>
+#include <assert.h>
+#include "test.h"
+#include "usctest.h"
+
+static void io_error(const char *func, int rc);
+static void work_done(io_context_t ctx, struct iocb *iocb, long res, long res2);
+static int io_wait_run(io_context_t ctx, struct timespec *to);
+static int io_tio(char *pathname , int flag , int n , int operation);
+void setup();
+void cleanup();
+
+char *TCID = "aio02";
+int TST_TOTAL=8;
+extern int Tst_count;
+
+#define AIO_MAXIO 32
+#define AIO_BLKSIZE (64*1024)
+#define AIO_TESTCASES 8
+static int alignment = 512;
+static int wait_count = 0;
+
+
+int main(int ac, char **av)
+{
+ int lc; /* loop counter */
+ char *msg; /* message returned from parse_opts */
+ char testfilename[256];
+ int i;
+ int operations[] = {
+ IO_CMD_PWRITE,
+ IO_CMD_PREAD,
+ IO_CMD_PWRITE,
+ IO_CMD_PREAD,
+ IO_CMD_PWRITE,
+ IO_CMD_PREAD,
+ IO_CMD_FSYNC,
+ IO_CMD_FDSYNC
+ };
+ int flags[] = {
+ O_TRUNC | O_DIRECT | O_WRONLY | O_CREAT | O_LARGEFILE, //IO_CMD_PWRITE
+ O_RDONLY | O_DIRECT | O_CREAT | O_LARGEFILE, //IO_CMD_PREAD
+ O_TRUNC | O_RDWR | O_CREAT, //IO_CMD_PWRITE
+ O_RDWR | O_CREAT, //IO_CMD_PREAD
+ O_TRUNC | O_WRONLY | O_CREAT, //IO_CMD_PWRITE
+ O_RDONLY| O_CREAT, //IO_CMD_PREAD
+ O_TRUNC | O_DIRECT | O_WRONLY | O_CREAT | O_LARGEFILE, //IO_CMD_FSYNC
+ O_TRUNC | O_DIRECT | O_WRONLY | O_CREAT | O_LARGEFILE //IO_CMD_FDSYNC
+ };
+ char * tips[] = {"aio_fsync for IO_CMD_FSYNC", "aio_dfsync for IO_CMD_FDSYNC", "Operation"};
+ char * tips_ptr = NULL;
+
+
+ /***************************************************************
+ * parse standard options
+ ***************************************************************/
+ if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
+ tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
+
+ /***************************************************************
+ * perform global setup for test
+ ***************************************************************/
+ setup();
+ sprintf(testfilename, "aio02test%d", getpid());
+
+ /***************************************************************
+ * check looping state if -c option given
+ ***************************************************************/
+ for (lc=0; TEST_LOOPING(lc); lc++) {
+ for (i = 0; i < AIO_TESTCASES; i++) {
+ TEST(io_tio(testfilename, flags[i], AIO_MAXIO , operations[i]));
+
+ /* check return code */
+ if ( TEST_RETURN < 0 ) {
+ if (TEST_RETURN == -EINVAL) {
+ if (operations[i] == IO_CMD_FSYNC) {
+ tips_ptr = tips[0];
+ } else if (operations[i] == IO_CMD_FDSYNC) {
+ tips_ptr = tips[1];
+ }
+ else {
+ tips_ptr = tips[2];
+ }
+ tst_resm(TINFO, "%s used by Test %d isn't"
+ " supported by this filesystem, errno=%d : %s"
+ , tips_ptr, i + 1, TEST_RETURN, strerror(-TEST_RETURN));
+ }
+ else {
+ if (TEST_RETURN != -1) {
+ TEST_ERRNO = -TEST_RETURN;
+ }
+ TEST_ERROR_LOG(TEST_ERRNO);
+ tst_resm(TFAIL, "Test %d failed, errno=%d : %s",
+ i + 1, 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, "Test %d succeed, returned %d", i + 1, TEST_RETURN);
+ }
+ }
+ }
+ }
+ unlink(testfilename);
+
+ /***************************************************************
+ * cleanup and exit
+ ***************************************************************/
+ cleanup();
+
+ return 0;
+} /* End main */
+
+/* Fatal error handler */
+static void io_error(const char *func, int rc)
+{
+ if (rc == -ENOSYS)
+ fprintf(stderr, "AIO not in this kernel\n");
+ else if (rc < 0)
+ fprintf(stderr, "%s: %s\n", func, strerror(-rc));
+ else
+ fprintf(stderr, "%s: error %d\n", func, rc);
+
+ exit(rc);
+}
+
+
+/*
+ * write work done
+ *
+ */
+static void work_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
+{
+
+ if (res2 != 0) {
+ io_error("aio write", res2);
+ }
+
+ if (res != iocb->u.c.nbytes) {
+ fprintf(stderr, "write missed bytes expect %lu got %ld\n",
+ iocb->u.c.nbytes, res2);
+ exit(-1);
+ }
+ wait_count --;
+}
+
+/*
+ * io_wait_run() - wait for an io_event and then call the callback.
+ */
+static int io_wait_run(io_context_t ctx, struct timespec *to)
+{
+ struct io_event events[AIO_MAXIO];
+ struct io_event *ep;
+ int ret, n;
+
+ /*
+ * get up to aio_maxio events at a time.
+ */
+ ret = n = io_getevents( ctx, 1, AIO_MAXIO, events, to );
+
+ /*
+ * Call the callback functions for each event.
+ */
+ for ( ep = events ; n-- > 0 ; ep++ ) {
+ io_callback_t cb = ( io_callback_t)ep->data ; struct iocb *iocb = ep->obj ; cb(ctx, iocb, ep->res, ep->res2);
+ }
+ return ret;
+}
+
+
+static int io_tio(char *pathname , int flag , int n , int operation)
+{
+ int res , fd = 0 , i = 0;
+ void * bufptr = NULL;
+ off_t offset = 0;
+ struct timespec timeout;
+
+ io_context_t myctx;
+ struct iocb iocb_array[AIO_MAXIO];
+ struct iocb *iocbps[AIO_MAXIO];
+
+ fd = open ( pathname , flag );
+ if ( fd <= 0 ) {
+ return -1;
+ }
+
+ res = io_queue_init(n, &myctx);
+ if (res < 0) {
+ return -1;
+ }
+
+ for ( i = 0 ; i < AIO_MAXIO ; i ++ ) {
+
+ switch (operation) {
+ case IO_CMD_FSYNC :
+ case IO_CMD_FDSYNC :
+ case IO_CMD_PWRITE :
+ {
+ res = posix_memalign ( &bufptr , alignment , AIO_BLKSIZE );
+ if (res != 0) {
+ return res;
+ }
+ memset ( bufptr , 0 , AIO_BLKSIZE );
+
+ io_prep_pwrite ( &iocb_array[i] , fd , bufptr , AIO_BLKSIZE , offset );
+ io_set_callback( &iocb_array[i] , work_done );
+ iocbps[i] = &iocb_array[i];
+ offset += AIO_BLKSIZE;
+ }
+ break;
+ case IO_CMD_PREAD :
+ {
+ res = posix_memalign ( &bufptr , alignment , AIO_BLKSIZE );
+ if (res != 0) {
+ return res;
+ }
+ memset ( bufptr , 0 , AIO_BLKSIZE );
+
+ io_prep_pread ( &iocb_array[i] , fd , bufptr , AIO_BLKSIZE , offset );
+ io_set_callback( &iocb_array[i] , work_done );
+ iocbps[i] = &iocb_array[i];
+ offset += AIO_BLKSIZE;
+ }
+ break;
+ case IO_CMD_POLL :
+ {
+
+ }
+ break;
+ case IO_CMD_NOOP :
+ {
+
+ }
+ break;
+ default:
+ {
+ fprintf ( stderr , "CMD Failed \n" );
+ return -1;
+ }
+ break;
+ }
+ }
+
+ if (( res = io_submit ( myctx , AIO_MAXIO , iocbps )) < 0 ) {
+ io_error("io_submit tio", res);
+ }
+
+ /*
+ * We have submitted all the i/o requests. Wait for at least one to complete
+ * and call the callbacks.
+ */
+ wait_count = AIO_MAXIO;
+
+ timeout.tv_sec = 30;
+ timeout.tv_nsec = 0;
+
+ switch ( operation ) {
+ case IO_CMD_PREAD :
+ case IO_CMD_PWRITE :
+ {
+ while ( wait_count ) {
+ res = io_wait_run( myctx , &timeout );
+ if ( res < 0 )
+ io_error("io_wait_run", res);
+ }
+ }
+ break;
+ case IO_CMD_FSYNC :
+ {
+ for ( i = 0 ; i < AIO_MAXIO ; i ++ ) {
+ return io_fsync( myctx , iocbps[i] , work_done , fd);
+ }
+ }
+ break;
+ case IO_CMD_FDSYNC :
+ {
+ for ( i = 0 ; i < AIO_MAXIO ; i ++ ) {
+ return io_fdsync( myctx , iocbps[i] , work_done , fd);
+ }
+ }
+ break;
+ default :
+ {
+
+ }
+ break;
+ }
+
+
+ close ( fd );
+
+ for ( i = 0 ; i < AIO_MAXIO ; i ++ ) {
+ if ( iocb_array[i].u.c.buf != NULL ) {
+ free ( iocb_array[i].u.c.buf );
+ }
+ }
+
+ io_queue_release ( myctx );
+
+ return 0;
+}
+
+
+/***************************************************************
+ * setup() - performs all ONE TIME setup for this test.
+ ***************************************************************/
+void
+setup()
+{
+ /* capture signals */
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ /* Pause if that option was specified */
+ TEST_PAUSE;
+} /* End setup() */
+
+
+/***************************************************************
+ * 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;
+
+ /* exit with return code appropriate for results */
+ tst_exit();
+} /* End cleanup() */
+
diff -purN a/testcases/kernel/io/aio/aio02/cases/aio_tio.c b/testcases/kernel/io/aio/aio02/cases/aio_tio.c
--- a/testcases/kernel/io/aio/aio02/cases/aio_tio.c 2006-07-18 06:27:46.000000000 +0800
+++ b/testcases/kernel/io/aio/aio02/cases/aio_tio.c 1970-01-01 08:00:00.000000000 +0800
@@ -1,278 +0,0 @@
-/*************************************************************************************
-*
-* Copyright (c) International Business Machines Corp., 2003
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
-* the GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation,
-*
-* FILE : aio_tio
-* USAGE : runfstest case/aio_tio
-*
-* DESCRIPTION : This program will test Asynchronous I/O for 2.5 Kernel infrastructure
-* REQUIREMENTS:
-* 1) libaio-0.3.92 or up for 2.5 kernal
-* 2) glibc 2.1.91 or up
-* HISTORY :
-* 11/03/2003 Kai Zhao (ltcd3@...)
-*
-* CODE COVERAGE:
-* 68.3% - fs/aio.c
-*
-************************************************************************************/
-
-#include "common.h"
-#define AIO_MAXIO 32
-#define AIO_BLKSIZE (64*1024)
-static int alignment = 512;
-static int wait_count = 0;
-
-
-/*
- * write work done
- *
- */
-static void work_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
-{
-
- if (res2 != 0) {
- io_error("aio write", res2);
- }
-
- if (res != iocb->u.c.nbytes) {
- fprintf(stderr, "write missed bytes expect %lu got %ld\n",
- iocb->u.c.nbytes, res2);
- exit(1);
- }
- wait_count --;
-}
-
-/*
- * io_wait_run() - wait for an io_event and then call the callback.
- */
-int io_wait_run(io_context_t ctx, struct timespec *to)
-{
- struct io_event events[AIO_MAXIO];
- struct io_event *ep;
- int ret, n;
-
- /*
- * get up to aio_maxio events at a time.
- */
- ret = n = io_getevents( ctx, 1, AIO_MAXIO, events, to );
-
- /*
- * Call the callback functions for each event.
- */
- for ( ep = events ; n-- > 0 ; ep++ ) {
- io_callback_t cb = ( io_callback_t)ep->data ; struct iocb *iocb = ep->obj ; cb(ctx, iocb, ep->res, ep->res2);
- }
- return ret;
-}
-
-
-int io_tio(char *pathname , int flag , int n , int operation)
-{
- int res , fd = 0 , i = 0;
- void * bufptr = NULL;
- off_t offset = 0;
- struct timespec timeout;
-
- io_context_t myctx;
- struct iocb iocb_array[AIO_MAXIO];
- struct iocb *iocbps[AIO_MAXIO];
-
- fd = open ( pathname , flag );
- if ( fd <= 0 ) {
- perror ( " open : file " );
- return -1;
- }
-
- res = io_queue_init(n, &myctx);
- //printf ( " res = %d \n", res);
-
- for ( i = 0 ; i < AIO_MAXIO ; i ++ ) {
-
- switch (operation) {
- case IO_CMD_FSYNC :
- case IO_CMD_FDSYNC :
- case IO_CMD_PWRITE :
- {
- if ( posix_memalign ( &bufptr , alignment , AIO_BLKSIZE )) {
- perror ( " posix_memalign failed " );
- return -1;
- }
- memset ( bufptr , 0 , AIO_BLKSIZE );
-
- io_prep_pwrite ( &iocb_array[i] , fd , bufptr , AIO_BLKSIZE , offset );
- io_set_callback( &iocb_array[i] , work_done );
- iocbps[i] = &iocb_array[i];
- offset += AIO_BLKSIZE;
- }
- break;
- case IO_CMD_PREAD :
- {
- if ( posix_memalign ( &bufptr , alignment , AIO_BLKSIZE )) {
- perror ( " posix_memalign failed " );
- return -1;
- }
- memset ( bufptr , 0 , AIO_BLKSIZE );
-
- io_prep_pread ( &iocb_array[i] , fd , bufptr , AIO_BLKSIZE , offset );
- io_set_callback( &iocb_array[i] , work_done );
- iocbps[i] = &iocb_array[i];
- offset += AIO_BLKSIZE;
- }
- break;
- case IO_CMD_POLL :
- {
-
- }
- break;
- case IO_CMD_NOOP :
- {
-
- }
- break;
- default:
- {
- fprintf ( stderr , "CMD Failed \n" );
- return -1;
- }
- break;
- }
- }
-
- if (( res = io_submit ( myctx , AIO_MAXIO , iocbps )) < 0 ) {
- io_error("io_submit tio", res);
- }
-
- /*
- * We have submitted all the i/o requests. Wait for at least one to complete
- * and call the callbacks.
- */
- wait_count = AIO_MAXIO;
-
- timeout.tv_sec = 30;
- timeout.tv_nsec = 0;
-
- switch ( operation ) {
- case IO_CMD_PREAD :
- case IO_CMD_PWRITE :
- {
- while ( wait_count ) {
- res = io_wait_run( myctx , &timeout );
- if ( res < 0 )
- io_error("io_wait_run", res);
- }
- }
- break;
- case IO_CMD_FSYNC :
- {
- for ( i = 0 ; i < AIO_MAXIO ; i ++ ) {
- res = io_fsync( myctx , iocbps[i] , work_done , fd);
- if ( res < 0 ) {
- io_error("io_fsync write", res);
- }
- }
- }
- break;
- case IO_CMD_FDSYNC :
- {
- for ( i = 0 ; i < AIO_MAXIO ; i ++ ) {
- res = io_fdsync( myctx , iocbps[i] , work_done , fd);
- if ( res < 0 ) {
- io_error("io_fsync write", res);
- }
- }
- }
- break;
- default :
- {
-
- }
- break;
- }
-
-
- close ( fd );
-
- for ( i = 0 ; i < AIO_MAXIO ; i ++ ) {
- if ( iocb_array[i].u.c.buf != NULL ) {
- free ( iocb_array[i].u.c.buf );
- }
- }
-
- io_queue_release ( myctx );
-
- return 0;
-}
-
-int test_main(void)
-{
- int status = 0 ;
- //char *filepath = "testdir/file1";
-
- printf("running test 1 \n");
- status = io_tio( "testdir/file1" , O_TRUNC | O_DIRECT | O_WRONLY | O_CREAT | O_LARGEFILE , AIO_MAXIO , IO_CMD_PWRITE);
- if ( status ) {
- return status;
- }
-
- printf("running test 2 \n");
- status = io_tio( "testdir/file1" , O_RDONLY | O_DIRECT | O_LARGEFILE , AIO_MAXIO , IO_CMD_PREAD);
- if ( status ) {
- return status;
- }
-
- printf("running test 3 \n");
- status = io_tio( "testdir/file1" , O_TRUNC | O_RDWR , AIO_MAXIO , IO_CMD_PWRITE );
- if ( status ) {
- return status;
- }
-
- printf("running test 4 \n");
- status = io_tio( "testdir/file1" , O_RDWR , AIO_MAXIO , IO_CMD_PREAD );
- if ( status ) {
- return status;
- }
-
- printf("running test 5 \n");
- status = io_tio( "testdir/file1" , O_TRUNC | O_WRONLY , AIO_MAXIO , IO_CMD_PWRITE );
- if ( status ) {
- return status;
- }
-
- printf("running test 6 \n");
- status = io_tio( "testdir/file1" , O_RDONLY , AIO_MAXIO , IO_CMD_PREAD );
- if ( status ) {
- return status;
- }
-
- printf("running test 7 \n");
- status = io_tio( "testdir/file2" , O_TRUNC | O_DIRECT | O_WRONLY | O_CREAT | O_LARGEFILE ,
- AIO_MAXIO , IO_CMD_FSYNC);
- if ( status ) {
- return status;
- }
-
- printf("running test 8 \n");
- status = io_tio( "testdir/file2" , O_TRUNC | O_DIRECT | O_WRONLY | O_CREAT | O_LARGEFILE ,
- AIO_MAXIO , IO_CMD_FDSYNC);
- if ( status ) {
- return status;
- }
-
- return status;
-}
-
diff -purN a/testcases/kernel/io/aio/aio02/cases/common.h b/testcases/kernel/io/aio/aio02/cases/common.h
--- a/testcases/kernel/io/aio/aio02/cases/common.h 2006-07-18 06:27:46.000000000 +0800
+++ b/testcases/kernel/io/aio/aio02/cases/common.h 1970-01-01 08:00:00.000000000 +0800
@@ -1,24 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/select.h>
-#include <libaio.h>
-#include <sys/uio.h>
-#include <assert.h>
-
-/* Fatal error handler */
-static void io_error(const char *func, int rc)
-{
- if (rc == -ENOSYS)
- fprintf(stderr, "AIO not in this kernel\n");
- else if (rc < 0)
- fprintf(stderr, "%s: %s\n", func, strerror(-rc));
- else
- fprintf(stderr, "%s: error %d\n", func, rc);
-
- exit(1);
-}
diff -purN a/testcases/kernel/io/aio/aio02/main.c b/testcases/kernel/io/aio/aio02/main.c
--- a/testcases/kernel/io/aio/aio02/main.c 2006-07-18 06:27:46.000000000 +0800
+++ b/testcases/kernel/io/aio/aio02/main.c 1970-01-01 08:00:00.000000000 +0800
@@ -1,27 +0,0 @@
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <libaio.h>
-
-char test_name[] = TEST_NAME;
-
-#include TEST_NAME
-
-int main(void)
-{
- int res;
-
- res = test_main();
- printf("test %s completed %s.\n", test_name,
- res ? "FAILED" : "PASSED"
- );
- fflush(stdout);
- return res ? 1 : 0;
-}
diff -purN a/testcases/kernel/io/aio/aio02/Makefile b/testcases/kernel/io/aio/aio02/Makefile
--- a/testcases/kernel/io/aio/aio02/Makefile 2006-07-18 06:27:46.000000000 +0800
+++ b/testcases/kernel/io/aio/aio02/Makefile 2006-08-17 14:37:47.000000000 +0800
@@ -1,17 +1,37 @@
-# foo.
-TEST_SRCS:=$(shell find cases/ -name \*.c | sort -n -t/ -k2)
-PROGS:=$(patsubst %.c,%,$(TEST_SRCS))
-HARNESS_SRCS:=main.c
-# io_queue.c
-
-CFLAGS=--static -Wall -g -O
-#-lpthread -lrt
-LIBAIO=-laio
-all: $(PROGS)
-
-$(PROGS): %: %.c $(HARNESS_SRCS)
- $(CC) $(CFLAGS) -DTEST_NAME=\"$<\" -o $@ main.c $(LIBAIO)
-
-clean:
- rm -f $(PROGS) *.o runtests.out rofile wofile rwfile
-
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+###########################################################################
+# name of file : Makefile #
+# description : make(1) description file #
+###########################################################################
+CFLAGS+= -I../../../../../include -Wall
+LOADLIBES+= -laio -L../../../../../lib -lltp
+
+SRCS=$(wildcard *.c)
+TARGETS=$(patsubst %.c,%,$(SRCS))
+
+all: $(TARGETS)
+
+install:
+ @set -e; for i in $(TARGETS); do ln -f $$i ../../../../bin/$$i ; done
+
+clean:
+ rm -f $(TARGETS)
+
+
diff -purN a/testcases/kernel/io/aio/aio02/README b/testcases/kernel/io/aio/aio02/README
--- a/testcases/kernel/io/aio/aio02/README 2006-07-18 06:27:46.000000000 +0800
+++ b/testcases/kernel/io/aio/aio02/README 1970-01-01 08:00:00.000000000 +0800
@@ -1,12 +0,0 @@
-This program will test Asynchronous I/O support by kernel 2.5 .
-make the program
- make
-execute the test
- ./runfstests.sh cases/aio_tio
-
-
-NOTE:
- make sure your system are support with libaio-0.3.92 or higher.
- you can download this form http://www.kernel.org.
- make sure your system are support with glibc 2.1.91 or higher.
-
diff -purN a/testcases/kernel/io/aio/aio02/runfstests.sh b/testcases/kernel/io/aio/aio02/runfstests.sh
--- a/testcases/kernel/io/aio/aio02/runfstests.sh 2006-07-18 06:27:46.000000000 +0800
+++ b/testcases/kernel/io/aio/aio02/runfstests.sh 1970-01-01 08:00:00.000000000 +0800
@@ -1,58 +0,0 @@
-#!/bin/sh
-
-echo "Starting the Tests"
-
-passes=0
-fails=0
-
-if [ ! -e testdir ]
-then
- mkdir -m 777 testdir
-fi
-
-echo "Test run starting at " `date`
-
-usage()
-{
- cat <<-END >&2
- usage: ${0##*/} [ -a test name ]
-
- example: ${0##*/} -a cases/aio_tio
-
- END
-exit
-}
-
-while getopts :a: arg
-do case $arg in
- a) this_test=$OPTARG;;
-
- \?) echo "************** Help Info: ********************"
- usage;;
- esac
-done
-
-if [ ! -n "$this_test" ]; then
- echo "Missing the test program. You must pass a test path/name for testing"
- usage;
- exit
-fi
-
-
-while [ $# -ge 1 ] ; do
- echo "Starting $this_test"
- $this_test
- res=$?
- if [ $res -eq 0 ] ;
- then str="";
- passes=$[passes +1];
- else
- str=" -- FAILED";
- fails=$[fails +1];
- fi
-done
-
-echo "Pass: $passes Fail: $fails"
-echo "Test run complete at" `date`
-
-rm -rf testdir
|