You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(40) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(205) |
Feb
(281) |
Mar
(428) |
Apr
(444) |
May
(137) |
Jun
(341) |
Jul
(509) |
Aug
(184) |
Sep
(51) |
Oct
(70) |
Nov
(52) |
Dec
(41) |
| 2004 |
Jan
(27) |
Feb
|
Mar
|
Apr
(99) |
May
(562) |
Jun
(36) |
Jul
(74) |
Aug
(61) |
Sep
(33) |
Oct
(76) |
Nov
(64) |
Dec
(71) |
| 2005 |
Jan
(19) |
Feb
(28) |
Mar
(726) |
Apr
(310) |
May
(325) |
Jun
(496) |
Jul
(192) |
Aug
(72) |
Sep
(41) |
Oct
(294) |
Nov
(79) |
Dec
(64) |
| 2006 |
Jan
(112) |
Feb
(267) |
Mar
(33) |
Apr
(16) |
May
(121) |
Jun
(77) |
Jul
(43) |
Aug
(281) |
Sep
(97) |
Oct
(19) |
Nov
(15) |
Dec
(50) |
| 2007 |
Jan
(2) |
Feb
(31) |
Mar
(21) |
Apr
(76) |
May
(36) |
Jun
(97) |
Jul
(93) |
Aug
(85) |
Sep
(77) |
Oct
(35) |
Nov
(106) |
Dec
(81) |
| 2008 |
Jan
(86) |
Feb
(139) |
Mar
(378) |
Apr
(127) |
May
(196) |
Jun
(108) |
Jul
(136) |
Aug
(137) |
Sep
(114) |
Oct
(229) |
Nov
(312) |
Dec
(180) |
| 2009 |
Jan
(747) |
Feb
(907) |
Mar
(371) |
Apr
(174) |
May
(192) |
Jun
(163) |
Jul
(744) |
Aug
(495) |
Sep
(85) |
Oct
(950) |
Nov
(311) |
Dec
(180) |
| 2010 |
Jan
(303) |
Feb
(33) |
Mar
(9) |
Apr
|
May
(1) |
Jun
(4) |
Jul
(18) |
Aug
(37) |
Sep
(2) |
Oct
(2) |
Nov
(6) |
Dec
(3) |
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
(1) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(17) |
Nov
(1) |
Dec
|
| 2013 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(5) |
| 2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(2) |
| 2016 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <iye...@us...> - 2003-01-08 15:35:46
|
Update of /cvsroot/ltp/ltp/testcases/commands/mail In directory sc8-pr-cvs1:/tmp/cvs-serv6742 Added Files: Makefile Log Message: Added make file to install mail_tests.sh --- NEW FILE: Makefile --- install: @ln -f cron_tests.sh ../../bin/mail_tests.sh |
|
From: <iye...@us...> - 2003-01-07 23:13:37
|
Update of /cvsroot/ltp/ltp/testcases/commands/mail
In directory sc8-pr-cvs1:/tmp/cvs-serv28229
Added Files:
mail_tests.sh
Log Message:
Added new testcase to test mail/mailx
--- NEW FILE: mail_tests.sh ---
################################################################################
## ##
## 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 ##
## ##
################################################################################
#
# File : mail_tests.sh
#
# Description: Tests basic mail command.
#
# Author: Manoj Iyer, ma...@ma...
#
# History: Jan 07 2003 - Created - Manoj Iyer.
#
#! /bin/sh
export TST_TOTAL=1
if [[ -z $LTPTMP && -z $TMPBASE ]]
then
LTPTMP=/tmp
else
LTPTMP=$TMPBASE
fi
if [[ -z $LTPBIN && -z $LTPROOT ]]
then
LTPBIN=./
else
LTPBIN=$LTPROOT/testcases/bin
fi
# Set return code RC variable to 0, it will be set with a non-zero return code
# in case of error. Set TFAILCNT to 0, increment if there occures a failure.
TFAILCNT=0
RC=0
RC1=0
RC2=0
# Test #1
# Test that mail user@domain will send a mail to that user at that domain.
export TCID=mail01
export TST_COUNT=1
$LTPBIN/tst_resm TINFO "Test #1: mail root@localhost will send mail to root"
$LTPBIN/tst_resm TINFO "Test #1: user on local machine."
cat > $LTPTMP/tst_mail.in <<EOF
This is a test email.
EOF
mail -s "Test" root@localhost < $LTPTMP/tst_mail.in \
&>$LTPTMP/tst_mail.out || RC=$?
if [ $RC -ne 0 ]
then
$LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.out \
"Test #1: mail command failed. Reason: "
TFAILCNT=$((TFAILCNT+1))
else
# check if root received a new email with Test as subject
# but wait for the mail to arrive.
sleep 10s
echo "d" | mail -u root &>$LTPTMP/tst_mail.res
mailsub=$(awk '/^>N/ {print $9}' $LTPTMP/tst_mail.res)
if [ $mailsub == "\"Test\"" ]
then
$LTPBIN/tst_resm TPASS "Test #1: Mail was send to root & was received"
else
$LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
"Test #1: Mail send to root, but was not received"
TFAILCNT=$((TFAILCNT+1))
fi
fi
#CLEANUP & EXIT
# remove all the temporary files created by this test.
#rm -fr $LTPTMP/tst_mail*
exit $TFAILCNT
|
|
From: <iye...@us...> - 2003-01-07 23:12:22
|
Update of /cvsroot/ltp/ltp/testcases/commands/mail In directory sc8-pr-cvs1:/tmp/cvs-serv27860/mail Log Message: Directory /cvsroot/ltp/ltp/testcases/commands/mail added to the repository |
|
From: <ro...@us...> - 2003-01-07 21:50:42
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/pwrite
In directory sc8-pr-cvs1:/tmp/cvs-serv22946/testcases/kernel/syscalls/pwrite
Added Files:
pwrite04.c
Log Message:
Added pwrite test ported by Airong Zhang.
--- NEW FILE: pwrite04.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
* pwrite04.c (ported from SPIE, section2/filesuite/pread_pwrite.c,
* by Airong Zhang)
*
* TEST SUMMARY
* Test the pwrite() system call with O_APPEND.
*
* USAGE
* pwrite04
*
*/
#define _XOPEN_SOURCE 500
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/fcntl.h>
#include <memory.h>
#include <errno.h>
#include "usctest.h"
#include "test.h"
char *TCID = "pwrite04";
int TST_TOTAL = 1;
extern int Tst_count;
int local_flag;
#define PASSED 1
#define FAILED 0
int block_cnt=0;
#define K1 1024
#define K2 (K1 * 2)
#define K3 (K1 * 3)
#define K4 (K1 * 4)
#define K5 (K1 * 5)
#define NBUFS 4
#define DATA_FILE "pwrite04_file"
char name[256], fname[256];
void init_buffers(char*[]);
void l_seek(int, off_t, int, off_t);
int main(int ac, char *av[])
{
int fd;
int nbytes ;
char *wbuf[NBUFS];
struct stat statbuf;
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
strcpy(name, DATA_FILE);
sprintf(fname, "%s.%d", name, getpid());
/*
* parse standard options
*/
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_resm(TBROK, "OPTION PARSING ERROR - %s", msg);
tst_exit();
/*NOTREACHED*/
}
tst_tmpdir();
for (lc = 0; TEST_LOOPING(lc); lc++) {
init_buffers(wbuf);
local_flag = PASSED;
if ((fd = open(fname, O_RDWR | O_CREAT, 0666)) < 0) {
tst_resm(TBROK, "open failed: fname = %s, errno = %d\n",
fname, errno);
tst_exit();
}
/*
* pwrite() K1 of data (0's) at offset 0.
*/
if ((nbytes = pwrite(fd, wbuf[0], K1, 0)) != K1) {
tst_resm(TFAIL, "pwrite at 0 failed: nbytes=%d, errno=%d\n",
nbytes, errno) ;
tst_exit();
}
/*
* We should still be at offset 0.
*/
l_seek(fd, 0, SEEK_CUR, 0);
/*
* lseek() to a non K boundary, just to be different.
*/
l_seek(fd, K1/2, SEEK_SET, K1/2);
/*
* pwrite() K1 of data (2's) at offset K2.
*/
if ((nbytes = pwrite(fd, wbuf[2], K1, K2)) != K1) {
tst_resm(TFAIL, "pwrite at K2 failed: nbytes=%d, errno=%d\n",
nbytes, errno) ;
tst_exit() ;
}
/*
* We should still be at our non K boundary.
*/
l_seek(fd, 0, SEEK_CUR, K1/2);
/*
* lseek() to an offset of K3.
*/
l_seek(fd, K3, SEEK_SET, K3);
/*
* This time use a normal write() of K1 of data (3's) which should
* take place at an offset of K3, moving the file pointer to K4.
*/
if ((nbytes = write(fd, wbuf[3], K1)) != K1) {
tst_resm(TFAIL, "write failed: nbytes=%d, errno=%d\n",
nbytes, errno) ;
tst_exit();
}
/*
* We should be at offset K4.
*/
l_seek(fd, 0, SEEK_CUR, K4);
/*
* pwrite() K1 of data (1's) at offset K1.
*/
if ((nbytes = pwrite(fd, wbuf[1], K1, K1)) != K1) {
tst_resm(TFAIL, "pwrite failed: nbytes=%d, errno=%d\n",
nbytes, errno) ;
tst_exit() ;
}
/*--------------------------------------------------------------*/
/*
* Now test that O_APPEND takes precedence over any
* offset specified by pwrite(), but that the file
* pointer remains unchanged. First, close then reopen
* the file and ensure it is already K4 in length and
* set the file pointer to it's midpoint, K2.
*/
close(fd);
if ((fd = open(fname, O_RDWR | O_APPEND, 0666)) < 0) {
tst_resm(TBROK, "open failed: fname = %s, errno = %d\n",
fname, errno);
tst_exit();
}
if (fstat(fd, &statbuf) == -1) {
tst_resm(TFAIL, "fstat failed: errno = %d\n", errno);
tst_exit();
}
if (statbuf.st_size != K4) {
tst_resm(TFAIL, "file size is %ld != K4\n", statbuf.st_size);
tst_exit();
}
l_seek(fd, K2, SEEK_SET, K2);
/*
* Finally, pwrite() some K1 of data at offset 0.
* What we should end up with is:
* -The file pointer should still be at K2.
* -The data should have been written to the end
* of the file (O_APPEND) and should be K5 in size.
*/
if ((nbytes = pwrite(fd, wbuf[0], K1, 0)) != K1) {
tst_resm(TFAIL, "pwrite at 0 failed: nbytes=%d, errno=%d\n",
nbytes, errno) ;
tst_exit();
}
l_seek(fd, 0, SEEK_CUR, K2);
if (fstat(fd, &statbuf) == -1) {
tst_resm(TFAIL, "fstat failed: errno = %d\n", errno);
tst_exit();
}
if (statbuf.st_size != K5) {
tst_resm(TFAIL, "file size is %ld != K4\n", statbuf.st_size);
tst_exit();
}
tst_resm(TPASS, "O_APPEND test passed.\n");
/*------------------------------------------------------------------------*/
close(fd);
unlink(fname);
} /* end for */
tst_rmdir();
tst_exit();
return(0);
}
/*------------------------------------------------------------------------*/
/*
* init_buffers() allocates wbuf[] array
* as follows:
* wbuf[0] has 0's, wbuf[1] has 1's, wbuf[2] has 2's, and wbuf[3] has 3's.
*/
void init_buffers(char *wbuf[])
{
int i;
for (i = 0; i < NBUFS; i++) {
wbuf[i] = (char *)malloc(K1);
if (wbuf[i] == NULL) {
tst_resm(TBROK, "ib: malloc failed: errno=%d\n", errno);
tst_exit();
}
memset(wbuf[i], i, K1);
}
}
/*
* l_seek() is a local front end to lseek().
* "checkoff" is the offset at which we believe we should be at.
* Used to validate pwrite doesn't move the offset.
*/
void
l_seek(int fdesc, off_t offset, int whence, off_t checkoff)
{
off_t offloc;
if ((offloc = lseek(fdesc, offset, whence)) != checkoff) {
tst_resm(TFAIL, "(%ld = lseek(%d, %ld, %d)) != %ld) errno = %d\n",
offloc, fdesc, offset, whence, checkoff, errno);
tst_exit();
}
}
|
|
From: <ro...@us...> - 2003-01-07 21:50:41
|
Update of /cvsroot/ltp/ltp/runtest In directory sc8-pr-cvs1:/tmp/cvs-serv22946/runtest Modified Files: syscalls Log Message: Added pwrite test ported by Airong Zhang. Index: syscalls =================================================================== RCS file: /cvsroot/ltp/ltp/runtest/syscalls,v retrieving revision 1.107 retrieving revision 1.108 diff -u -d -r1.107 -r1.108 --- syscalls 6 Jan 2003 20:43:47 -0000 1.107 +++ syscalls 7 Jan 2003 21:50:34 -0000 1.108 @@ -505,6 +505,7 @@ pwrite01 pwrite01 pwrite02 pwrite02 pwrite03 pwrite03 +pwrite04 pwrite04 query_module01 query_module01 query_module02 query_module02 |
|
From: <ro...@us...> - 2003-01-07 20:55:26
|
Update of /cvsroot/ltp/ltp/testcases/kernel/fs/ftest
In directory sc8-pr-cvs1:/tmp/cvs-serv32192
Added Files:
ftest07.c
Log Message:
--- NEW FILE: ftest07.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
* ftest07.c -- test file I/O with readv and writev (ported from SPIE,
* section2/filesuite/ftest9.c
*
* this is the same as ftest4, except that it uses lseek64
*
* CALLS
* lseek64, readv, writev,
* truncate, ftruncate, fsync, sync, fstat
*
* ALGORITHM
* A bitmap is used to map pieces of a file.
* Loop: pick a random piece of the file
* if we haven't seen it before make sure it is zero,
* write pattern
* if we have seen it before make sure correct pattern.
*
* This was originally written by rbk - was program tfio.c
* Modified by dale to integrate with test suites.
* Modified by G. Stevens to use readv and writev.
* Modofied by K. Hakim to integrate with SPIES.
*
* RESTRICTIONS
* 1. Runs a long time with default args - can take others on input
* line. Use with "term mode".
* If run on vax the ftruncate will not be random - will always go to
* start of file. NOTE: produces a very high load average!!
*
* 2. The "csize" argument must be evenly divisible by MAXIOVCNT.
*
* CAUTION!!
* If a file is supplied to this program with the "-f" option
* it will be removed with a system("rm -rf filename") call.
*
*
*/
#define _XOPEN_SOURCE 500
#define _LARGEFILE64_SOURCE 1
#include <sys/types.h>
#include <sys/param.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/errno.h>
#include <sys/uio.h>
#include <fcntl.h>
#include <signal.h> /* DEM - added SIGTERM support */
#include <stdio.h> /* needed by testhead.h */
#include <unistd.h>
#include "test.h"
#include "usctest.h"
char *TCID = "ftest07";
int TST_TOTAL = 1;
extern int Tst_count;
#define PASSED 1
#define FAILED 0
#define MAXCHILD 25 /* max number of children to allow */
#define K_1 1024
#define K_2 2048
#define K_4 4096
#define MAXIOVCNT 16
void setup();
int runtest();
int dotest(int, int, int);
int domisc(int, int, char*);
int bfill(char*, char, int);
int dumpiov(struct iovec*);
int dumpbits(char*, int);
int orbits(char*, char*, int);
int term();
extern int errno;
int csize; /* chunk size */
int iterations; /* # total iterations */
off64_t max_size; /* max file size */
int misc_intvl; /* for doing misc things; 0 ==> no */
int nchild; /* how many children */
int nwait;
int fd; /* file descriptor used by child */
int parent_pid;
int pidlist[MAXCHILD];
char test_name[2]; /* childs test directory name */
char *prog, *getcwd() ;
char fuss[40] = ""; /* directory to do this in */
char homedir[200]= ""; /* where we started */
char msg1[] = "Error on openning console.\n";
char msg2[] = "1st open not fd 0!\n";
int local_flag;
/*--------------------------------------------------------------*/
int main (ac, av)
int ac;
char *av[];
{
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
/*
* parse standard options
*/
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_resm(TBROK, "OPTION PARSING ERROR - %s", msg);
tst_exit();
/*NOTREACHED*/
}
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
local_flag = PASSED;
runtest();
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed.\n");
} else {
tst_resm(TFAIL, "Test failed.\n");
}
tst_rmdir();
tst_exit();
} /* end for */
return(0);
}
/*--------------------------------------------------------------*/
void setup()
{
char wdbuf[MAXPATHLEN], *cwd ;
int term();
/*
* Make a directory to do this in; ignore error if already exists.
* Save starting directory.
*/
if ( (cwd = getcwd(homedir, sizeof( homedir))) == NULL ) {
tst_resm(TBROK,"Failed to get corrent directory\n") ;
tst_exit() ;
}
parent_pid = getpid();
tst_tmpdir();
if (!fuss[0])
sprintf(fuss, "%s/ftest07.%d", getcwd(wdbuf, sizeof( wdbuf)), getpid());
mkdir(fuss, 0755);
if (chdir(fuss) < 0) {
tst_resm(TBROK,"\tCan't chdir(%s), error %d.\n", fuss, errno);
tst_exit() ;
}
/*
* Default values for run conditions.
*/
iterations = 10;
nchild = 5;
csize = K_2; /* should run with 1, 2, and 4 K sizes */
max_size = K_1 * K_1;
misc_intvl = 10;
if (sigset(SIGTERM, (void (*)())term) == SIG_ERR) {
tst_resm(TBROK, " sigset failed: signo = 15\n") ;
tst_exit() ;
}
}
int runtest()
{
register int i;
int pid;
int child;
int status;
int count;
for(i = 0; i < nchild; i++) {
test_name[0] = 'a' + i;
test_name[1] = '\0';
fd = open(test_name, O_RDWR|O_CREAT|O_TRUNC, 0666);
if (fd < 0) {
tst_resm(TBROK, "\tError %d creating %s/%s.\n", errno, fuss, test_name);
tst_exit();
}
if ((child = fork()) == 0) { /* child */
dotest(nchild, i, fd); /* do it! */
tst_exit(); /* when done, exit */
}
close(fd);
if (child < 0) {
tst_resm(TINFO, "System resource may be too low, fork() malloc()"
" etc are likely to fail.\n");
tst_resm(TBROK, "Test broken due to inability of fork.\n");
tst_exit();
} else {
pidlist[i] = child;
nwait++;
}
}
/*
* Wait for children to finish.
*/
count = 0;
while(1)
{
if ((child = wait(&status)) >= 0) {
//tst_resm(TINFO, "\tTest{%d} exited status = 0x%x\n", child, status);
if (status) {
tst_resm(TFAIL, "\tTest{%d} failed, expected 0 exit.\n", child);
local_flag = FAILED;
}
++count;
}
else
{
if (errno != EINTR)
break;
}
}
/*
* Should have collected all children.
*/
if (count != nwait) {
tst_resm(TFAIL, "\tWrong # children waited on, count = %d\n", count);
local_flag = FAILED;
}
chdir(homedir);
pid = fork();
if (pid < 0) {
tst_resm(TINFO, "System resource may be too low, fork() malloc()"
" etc are likely to fail.\n");
tst_resm(TBROK, "Test broken due to inability of fork.\n");
tst_exit();
}
if (pid == 0) {
execl("/bin/rm", "rm", "-rf", fuss, 0);
exit(1);
} else
wait(&status);
if (status) {
tst_resm(TINFO, "CAUTION - ftest07, '%s' may not be removed\n", fuss);
}
sync(); /* safeness */
return(0);
}
/*
* dotest()
* Children execute this.
*
* Randomly read/mod/write chunks with known pattern and check.
* When fill sectors, iterate.
*/
#define NMISC 4
enum m_type { m_fsync, m_trunc, m_sync, m_fstat };
char *m_str[] = {
"fsync", "trunc", "sync", "fstat"
};
int misc_cnt[NMISC]; /* counts # of each kind of misc */
int file_max; /* file-max size */
int nchunks;
int last_trunc = -1;
int tr_flag;
enum m_type type = m_fsync;
#define CHUNK(i) (((off64_t)i) * csize)
#define NEXTMISC ((rand() % misc_intvl) + 5)
int dotest(testers, me, fd)
int testers;
int me;
int fd;
{
register int i;
char *bits;
char *hold_bits;
int count;
int collide;
char val;
int chunk;
int whenmisc;
int xfr;
/* Stuff for the readv call */
struct iovec r_iovec[MAXIOVCNT];
int r_ioveclen;
/* Stuff for the writev call */
struct iovec val_iovec[MAXIOVCNT];
struct iovec zero_iovec[MAXIOVCNT];
int w_ioveclen;
nchunks = max_size / csize;
if( (bits = (char*)malloc((nchunks+7) / 8)) == 0) {
tst_resm(TBROK, "\tmalloc failed(bits)\n");
tst_exit();
}
if( (hold_bits = (char*)malloc((nchunks+7) / 8)) == 0) {
tst_resm(TBROK, "\tmalloc failed(hlod_bits)\n");
tst_exit();
}
/*Allocate memory for the iovec buffers and init the iovec arrays
*/
r_ioveclen = w_ioveclen = csize / MAXIOVCNT;
/* Please note that the above statement implies that csize
* be evenly divisible by MAXIOVCNT.
*/
for (i = 0; i < MAXIOVCNT; i++) {
if( (r_iovec[i].iov_base = (char*)malloc(r_ioveclen)) == 0) {
tst_resm(TFAIL, "\tmalloc failed(r_iovec[i].iov_base)\n");
tst_exit();
}
r_iovec[i].iov_len = r_ioveclen;
/* Allocate unused memory areas between all the buffers to
* make things more diffult for the OS.
*/
if(malloc((i+1)*8) == 0) {
tst_resm(TBROK, "\tmalloc failed((i+1)*8)\n");
tst_exit();
}
if( (val_iovec[i].iov_base = (char*)malloc(w_ioveclen)) == 0) {
tst_resm(TBROK, "\tmalloc failed(val_iovec[i]\n");
exit(1);
}
val_iovec[i].iov_len = w_ioveclen;
if(malloc((i+1)*8) == 0) {
tst_resm(TBROK, "\tmalloc failed((i+1)*8)\n");
tst_exit();
}
if( (zero_iovec[i].iov_base = (char*)malloc(w_ioveclen)) == 0) {
tst_resm(TBROK, "\tmalloc failed(zero_iover)\n");
tst_exit();
}
zero_iovec[i].iov_len = w_ioveclen;
if(malloc((i+1)*8) == 0) {
tst_resm(TBROK, "\tmalloc failed((i+1)*8)\n");
tst_exit();
}
}
/*
* No init sectors; allow file to be sparse.
*/
val = (64/testers) * me + 1;
/*
* For each iteration:
* zap bits array
* loop
* pick random chunk, read it.
* if corresponding bit off {
* verify = 0. (sparse file)
* ++count;
* } else
* verify = val.
* write "val" on it.
* repeat unitl count = nchunks.
* ++val.
*/
srand(getpid());
if (misc_intvl) whenmisc = NEXTMISC;
while(iterations-- > 0) {
for(i = 0; i < NMISC; i++)
misc_cnt[i] = 0;
ftruncate(fd,0);
file_max = 0;
bfill(bits, 0, (nchunks+7) / 8);
bfill(hold_bits, 0, (nchunks+7) / 8);
/* Have to fill the val and zero iov buffers in a different manner
*/
for(i = 0; i < MAXIOVCNT; i++) {
bfill(val_iovec[i].iov_base,val,val_iovec[i].iov_len);
bfill(zero_iovec[i].iov_base,0,zero_iovec[i].iov_len);
}
count = 0;
collide = 0;
while(count < nchunks) {
chunk = rand() % nchunks;
/*
* Read it.
*/
if (lseek64(fd, CHUNK(chunk), 0) < (off64_t)0) {
tst_resm(TFAIL, "\tTest[%d]: lseek64(0) fail at %Lx, errno = %d.\n",
me, CHUNK(chunk), errno);
tst_exit();
}
if ((xfr = readv(fd, &r_iovec[0], MAXIOVCNT)) < 0) {
tst_resm(TFAIL, "\tTest[%d]: readv fail at %Lx, errno = %d.\n",
me, CHUNK(chunk), errno);
tst_exit();
}
/*
* If chunk beyond EOF just write on it.
* Else if bit off, haven't seen it yet.
* Else, have. Verify values.
*/
if (CHUNK(chunk) >= file_max) {
bits[chunk/8] |= (1<<(chunk%8));
++count;
} else if ((bits[chunk/8] & (1<<(chunk%8))) == 0) {
if (xfr != csize) {
tst_resm(TFAIL, "\tTest[%d]: xfr=%d != %d, zero read.\n",
me, xfr, csize);
tst_exit();
}
for(i=0;i<MAXIOVCNT; i++) {
if (memcmp(r_iovec[i].iov_base, zero_iovec[i].iov_base, r_iovec[i].iov_len)) {
tst_resm(TFAIL,
"\tTest[%d] bad verify @ 0x%Lx for val %d count %d xfr %d file_max 0x%x, should be 0.\n",
me, CHUNK(chunk), val, count, xfr, file_max);
tst_resm(TINFO, "\tTest[%d]: last_trunc = 0x%x.\n",
me, last_trunc);
sync();
dumpiov(&r_iovec[i]);
dumpbits(bits, (nchunks+7)/8);
orbits(hold_bits, bits, (nchunks+7)/8);
tst_resm(TINFO, "\tHold "); dumpbits(hold_bits, (nchunks+7)/8);
tst_exit();
}
}
bits[chunk/8] |= (1<<(chunk%8));
++count;
} else {
if (xfr != csize) {
tst_resm(TFAIL, "\tTest[%d]: xfr=%d != %d, val read.\n",
me, xfr, csize);
tst_exit();
}
++collide;
for(i=0; i<MAXIOVCNT; i++) {
if (memcmp(r_iovec[i].iov_base, val_iovec[i].iov_base, r_iovec[i].iov_len)) {
tst_resm(TFAIL, "\tTest[%d] bad verify @ 0x%Lx for val %d count %d xfr %d file_max 0x%x.\n",
me, CHUNK(chunk), val, count, xfr, file_max);
tst_resm(TINFO, "\tTest[%d]: last_trunc = 0x%x.\n",
me, last_trunc);
sync();
dumpiov(&r_iovec[i]);
dumpbits(bits, (nchunks+7)/8);
orbits(hold_bits, bits, (nchunks+7)/8);
tst_resm(TINFO, "\tHold "); dumpbits(hold_bits, (nchunks+7)/8);
tst_exit();
}
}
}
/*
* Writev it.
*/
if (lseek64(fd, -((off64_t)xfr), 1) < (off64_t)0) {
tst_resm(TFAIL, "\tTest[%d]: lseek64(1) fail at %Lx, errno = %d.\n",
me, CHUNK(chunk), errno);
tst_exit();
}
if ((xfr = writev(fd, &val_iovec[0], MAXIOVCNT)) < csize) {
if (errno == ENOSPC) {
tst_resm(TFAIL, "\tTest[%d]: no space, exiting.\n", me);
fsync(fd);
tst_exit();
}
tst_resm(TFAIL, "\tTest[%d]: writev fail at %Lx xfr %d, errno = %d.\n",
me, CHUNK(chunk), xfr, errno);
tst_exit();
}
if (CHUNK(chunk) + csize > file_max)
file_max = CHUNK(chunk) + csize;
/*
* If hit "misc" interval, do it.
*/
if (misc_intvl && --whenmisc <= 0) {
orbits(hold_bits, bits, (nchunks+7)/8);
domisc(me, fd, bits);
whenmisc = NEXTMISC;
}
if (count + collide > 2 * nchunks)
break;
}
/*
* End of iteration, maybe before doing all chunks.
*/
fsync(fd);
++misc_cnt[(int)m_fsync];
//tst_resm(TINFO, "\tTest{%d} val %d done, count = %d, collide = {%d}\n",
// me, val, count, collide);
//for(i = 0; i < NMISC; i++)
// tst_resm(TINFO, "\t\tTest{%d}: {%d} %s's.\n", me, misc_cnt[i], m_str[i]);
++val;
}
return(0);
}
/*
* domisc()
* Inject misc syscalls into the thing.
*/
int domisc(me, fd, bits)
int me;
int fd;
char *bits;
{
register int chunk;
struct stat sb;
if ((int) type > (int) m_fstat)
type = m_fsync;
switch(type) {
case m_fsync:
if (fsync(fd) < 0) {
tst_resm(TFAIL, "\tTest[%d]: fsync error %d.\n", me, errno);
tst_exit();
}
break;
case m_trunc:
chunk = rand() % (file_max / csize);
file_max = CHUNK(chunk);
last_trunc = file_max;
if (tr_flag) {
if (ftruncate(fd, file_max) < 0) {
tst_resm(TFAIL, "\tTest[%d]: ftruncate error %d @ 0x%x.\n", me, errno, file_max);
tst_exit();
}
tr_flag = 0;
} else {
if (truncate(test_name, file_max) < 0) {
tst_resm(TFAIL, "\tTest[%d]: truncate error %d @ 0x%x.\n", me, errno, file_max);
tst_exit();
}
tr_flag = 1;
}
for(; chunk%8 != 0; chunk++)
bits[chunk/8] &= ~(1<<(chunk%8));
for(; chunk < nchunks; chunk += 8)
bits[chunk/8] = 0;
break;
case m_sync:
sync();
break;
case m_fstat:
if (fstat(fd, &sb) < 0) {
tst_resm(TFAIL, "\tTest[%d]: fstat() error %d.\n", me, errno);
tst_exit();
}
if (sb.st_size != file_max) {
tst_resm(TFAIL, "\tTest[%d]: fstat() mismatch; st_size=%x,file_max=%x.\n",
me, sb.st_size, file_max);
tst_exit();
}
break;
}
++misc_cnt[(int)type];
type = (enum m_type) ((int) type + 1);
return(0);
}
int bfill(buf, val, size)
register char *buf;
char val;
register int size;
{
register int i;
for(i = 0; i < size; i++)
buf[i] = val;
return(0);
}
/*
* dumpiov
* Dump the contents of the r_iovec buffer.
*/
int dumpiov(iovptr)
register struct iovec *iovptr;
{
register int i;
char val;
int idx;
int nout;
tst_resm(TINFO, "\tBuf:");
nout = 0;
idx = 0;
val = ((char *)iovptr->iov_base)[0];
for(i = 0; i < iovptr->iov_len; i++) {
if (((char *)iovptr->iov_base)[i] != val) {
if (i == idx+1)
tst_resm(TINFO, "\t%x, ", ((char *)iovptr->iov_base)[idx] & 0xff);
else
tst_resm(TINFO, "\t%d*%x, ", i-idx, ((char *)iovptr->iov_base)[idx] & 0xff);
idx = i;
++nout;
}
if (nout > 10) {
tst_resm(TINFO, "\t ... more\n");
return(0);
}
}
if (i == idx+1)
tst_resm(TINFO, "\t%x\n", ((char *)iovptr->iov_base)[idx] & 0xff);
else
tst_resm(TINFO, "\t%d*%x\n", i-idx, ((char *)iovptr->iov_base)[idx]);
return(0);
}
/*
* dumpbits
* Dump the bit-map.
*/
int dumpbits(bits, size)
char *bits;
register int size;
{
register char *buf;
tst_resm(TINFO, "\tBits array:");
for(buf = bits; size > 0; --size, ++buf) {
if ((buf-bits) % 16 == 0)
tst_resm(TINFO, "\t\n%04x:\t", 8*(buf-bits));
tst_resm(TINFO, "\t%02x ", (int)*buf & 0xff);
}
return(0);
}
int orbits(hold, bits, count)
register char *hold;
register char *bits;
register int count;
{
while(count-- > 0)
*hold++ |= *bits++;
return(0);
}
/* term()
*
* This is called when a SIGTERM signal arrives.
*/
int term()
{
register int i;
tst_resm(TINFO, "\tterm -[%d]- got sig term.\n", getpid());
/*
* If run by hand we like to have the parent send the signal to
* the child processes. This makes life easy.
*/
if (parent_pid == getpid()) {
for (i=0; i < nchild; i++)
if (pidlist[i]) /* avoid embarassment */
kill(pidlist[i], SIGTERM);
return(0);
}
tst_resm(TINFO, "\tunlinking '%s'\n", test_name);
close(fd);
if (unlink(test_name))
tst_resm(TBROK, "Unlink of '%s' failed, errno = %d.\n",
test_name, errno);
else
tst_resm(TINFO, "Unlink of '%s' successful.\n", test_name);
tst_exit();
return(0);
}
|
|
From: <ro...@us...> - 2003-01-07 20:53:58
|
Update of /cvsroot/ltp/ltp/testcases/kernel/fs In directory sc8-pr-cvs1:/tmp/cvs-serv30958/testcases/kernel/fs Modified Files: Makefile Log Message: Added filesystem testsuite, ftest, ported by Airong Zhang. Index: Makefile =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/fs/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile 6 Jan 2003 21:35:57 -0000 1.5 +++ Makefile 7 Jan 2003 20:53:22 -0000 1.6 @@ -1,4 +1,4 @@ -SUBDIRS = doio fs_inod fsstress fs_perms fsx-linux inode lftest linktest openfile proc stream +SUBDIRS = doio fs_inod fsstress fs_perms fsx-linux ftest inode lftest linktest openfile proc stream all: @for i in $(SUBDIRS); do $(MAKE) -C $$i ; done |
|
From: <ro...@us...> - 2003-01-07 20:53:56
|
Update of /cvsroot/ltp/ltp/runtest In directory sc8-pr-cvs1:/tmp/cvs-serv30958/runtest Modified Files: fs Log Message: Added filesystem testsuite, ftest, ported by Airong Zhang. Index: fs =================================================================== RCS file: /cvsroot/ltp/ltp/runtest/fs,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- fs 6 Jan 2003 21:35:55 -0000 1.11 +++ fs 7 Jan 2003 20:53:21 -0000 1.12 @@ -47,3 +47,11 @@ stream03 stream03 stream04 stream04 stream05 stream05 +ftest01 ftest01 +ftest02 ftest02 +ftest03 ftest03 +ftest04 ftest04 +ftest05 ftest05 +ftest06 ftest06 +ftest07 ftest07 +ftest08 ftest08 |
|
From: <iye...@us...> - 2003-01-07 19:04:04
|
Update of /cvsroot/ltp/ltp/testcases/commands/eject
In directory sc8-pr-cvs1:/tmp/cvs-serv20313
Modified Files:
eject-tests.sh
Log Message:
mods
Index: eject-tests.sh
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/commands/eject/eject-tests.sh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- eject-tests.sh 6 Jan 2003 22:11:35 -0000 1.8
+++ eject-tests.sh 7 Jan 2003 19:03:50 -0000 1.9
@@ -34,6 +34,7 @@
# - Corrected code to check if return code is not 0
# which indicated failure.
# - fixed code to add $LTPTMP/cdrom to /etc/fstab
+# Jan 07 2003 - Call eject with -v for verbose information.
#
#! /bin/sh
@@ -102,14 +103,22 @@
$LTPBIN/tst_resm TINFO "Test #2: eject commad with no options"
$LTPBIN/tst_resm TINFO "Test #2: will eject the default cdrom device."
-eject &>$LTPTMP/tst_eject.res || RC=$?
+eject -v &>$LTPTMP/tst_eject.res || RC=$?
if [ $RC -eq 0 ]
then
- # Close the tray if it is supported.
- eject -t &>/dev/null
- $LTPBIN/tst_resm TPASS "Test #2: eject succeded"
+ grep "CD-ROM eject command succeeded" $LTPTMP/tst_eject.res \
+ &>$LTPTMP/tst_eject.out || RC=$?
+ if [ $RC -eq 0 ]
+ then
+ # Close the tray if it is supported.
+ eject -t &>/dev/null
+ $LTPBIN/tst_resm TPASS "Test #2: eject succeded"
+ else
+ $LTPBIN/tst_res TFAIL $LTPTMP/tst_eject.out \
+ "Test #2: eject fail. Reason"
+ fi
else
- echo "Error code returned by eject: $RC" >> $LTPTMP/tst_eject.res \
+ echo "Error code returned by eject: $RC" >>$LTPTMP/tst_eject.res \
2&/dev/null
$LTPBIN/tst_res TFAIL $LTPTMP/tst_eject.res \
"Test #2: eject failed. Reason:"
@@ -133,16 +142,16 @@
if [ -d $LTPTMP/cdrom ]
then
- $LTPBIN/tst_resm TINFO \
+ $LTPBIN/tst_resm TINFO \
"Test #3: test cdrom mount point $LTPTMP/cdrom exists. Skip creation"
else
- mkdir -p $LTPTMP/cdrom &>$LTPTMP/tst_eject.out || RC=$?
- if [ $RC -ne 0 ]
- then
- $LTPBIN/tst_brk TBROK $LTPTMP/tst_eject.out NULL \
- "Test #3: failed to make directory $LTPTMP/cdrom. Reason:"
- TFAILCNT=$((TFAILCNT+1))
- fi
+ mkdir -p $LTPTMP/cdrom &>$LTPTMP/tst_eject.out || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_eject.out NULL \
+ "Test #3: failed to make directory $LTPTMP/cdrom. Reason:"
+ TFAILCNT=$((TFAILCNT+1))
+ fi
fi
echo "/dev/cdrom $LTPTMP/cdrom iso9660 defaults,ro,user,noauto 0 0" >>/etc/fstab 2>$LTPTMP/tst_eject.out || RC=$?
|
|
From: <mar...@us...> - 2003-01-07 18:08:16
|
Update of /cvsroot/ltp/ltp In directory sc8-pr-cvs1:/tmp/cvs-serv28658 Modified Files: ChangeLog Log Message: new ChangeLog Index: ChangeLog =================================================================== RCS file: /cvsroot/ltp/ltp/ChangeLog,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- ChangeLog 10 Dec 2002 20:48:03 -0000 1.38 +++ ChangeLog 7 Jan 2003 18:07:51 -0000 1.39 @@ -1,3 +1,112 @@ +LTP-20030110 + +- Added New test case to test 'file' command. ( Manoj Iyer ) +- Added new test to test basic functionality of ( Manoj Iyer ) + CRONTAB, CRON etc. +- Added new test case to test eject command ( Manoj Iyer ) +- Added new tests to test logrotate ( Manoj Iyer ) +- Added new testcase to test basic functionality ( Manoj Iyer ) + of tar command. +- Fixed mem01: The free memory size was being ( Robbie Williamson ) + incorrectly calculated, plus it could not + handle large amounts of memory...now using + long int, instead of int. +- Fixed mem01: Test was not cleaning up correctly ( Robbie Williamson ) + after a failure. +- Initial checkin of shmt, shared memory tests ( Robbie Williamson ) + from SPIE suite +- Initial checkin of pty testcases: hangup01(), ( Robbie Williamson ) + ptem01() and pty01() from SPIE testsuite. +- Added code to abort01.c to use the ( Robbie Williamson ) + tst_tmpdir()/tst_rmdir() APIs +- Added ported abort() test ( Ananda Venkataraman ) +- Added adjtimex() tests ( Saji Kumar ) +- Added capget() tests ( Saji Kumar ) +- Added capset() tests ( Saji Kumar ) +- Added ported test, creat08 ( Airong Zhang ) +- create08 was initially ported to create users ( Robbie Williamson ) + and groups that it needed. Rewrote the test to + use existing users/groups that are checked for + when the LTP is installed. +- Applied patch to create_module02 from creator ( T.L.Madhu ) +- Applied patch to delete_module02 from creator ( T.L.Madhu ) +- Added code to delete_module03 to allow tests to ( Robbie Williamson ) + execute under pan. +- Applied patch to delete_module03 from creator ( T.L.Madhu ) +- Added ported dup06 and dup07 tests ( Airong Zhang ) +- Added ported dup202 and dup205 tests ( Airong Zhang ) + and cleaned up some other files +- Initial checkin of fdatasync() tests ( T.L. Madhu ) +- Added new flock04 and flock05 tests ( Vatsal Avasthi ) +- Added ported fmtmsg() test ( Ananda Venkataraman ) +- Added functional test to gethostid01 to compare ( Paul Larson ) + result from gethostid() versus the hostid + command +- Initial checkin of getrusage() tests ( Saji Kumar ) +- Added ioperm() tests ( Subhabrata Biswas ) +- Added iopl() tests ( Subhab Biswas ) +- Added ported kill() tests ( Ananda Venkataraman ) +- Added ported mallopt() test ( Ananda Venkataraman ) +- Added ported memcmp() test ( Ananda Venkataraman ) +- Added ported memcpy() test ( Ananda Venkataraman ) +- Added ported memset() test ( Ananda Venkataraman ) +- Fixed mkdir09: the getopts() call was returning ( Robbie Williamson ) + it's -1 to a char variable. This was incorrect + and causing the test to loop forever on certain + architectures. +- Initial checkin of munlockall() tests ( Sowmya Adiga ) +- Fixed nftw64: tst_rmdir was in the wrong ( Robbie Williamson ) + location. +- Added ported open09() test ( Airong Zhang ) +- Initial checkin of prctl() tests ( Saji Kumar ) +- Added ported profil() test ( Ananda Venkataraman ) +- Initial checkin of ptrace() tests ( Saji Kumar ) +- Added code to query_module tests to allow ( Robbie Williamson ) + execution under pan. +- Initial checkin of reboot() tests ( Aniruddha Marathe ) +- Initial checkin of sched_rr_get_interval tests ( Saji Kumar ) +- Added setresgid() tests ( T.L. Madhu ) +- Fixed setrlimit03 to work on 2.5 and cleanup ( Paul Larson ) +- Added socketcall() tests ( Adiga Sowmya ) +- Added ported string.h test string01 ( Ananda Venkataraman ) +- Added swapoff() tests ( Aniruddha Marathe ) +- Added swapoff() tests ( Aniruddha Marathe ) +- Added swapon() test ( Aniruddha Marathe ) +- Made corrections to swapon02 to make sure the ( Robbie Williamson ) + child exits. +- Added ported syscall() test ( Ananda Venkataraman ) +- Removed an erroneous testcase in sysconf01 and ( Robbie Williamson ) + corrected a typo issue. +- Initial checkin of sysfs() tests ( Aniruddha Marathe ) +- Made changes to allow the syslog tests to ( Robbie Williamson ) + execute in pan and corrected a bug in backup + code for syslog.conf original file. +- Added syslog11 & syslog12 tests ( T.L. Madhu ) +- Fixed syslogtst if-statement comparing a file ( Robbie Williamson ) + descriptor to a hardcoded number was changed to + allow the test to run under pan. +- Changed the file opened for the 6th case in ( Robbie Williamson ) + syslogtst. +- Added ported abs() test ( Ananda Venkataraman ) +- Added ported atof() test ( Ananda Venkataraman ) +- Added ported nextafter() test ( Ananda Venkataraman ) +- Corrected bug in cleanup section of fsx.sh ( Robbie Williamson ) +- Added code to rusers01 to change a FQDN in ( Robbie Williamson ) + RHOST to short name. +- Fixed testsf_c bug in char* not large enough to ( Robbie Williamson ) + hold argv[4] string. +- Added command line version of LTP harness APIs ( Manoj Iyer ) + these commands will print LTP test results in + LTP harness format just like the ones printed + by C testcases. These commands can be used in + shell scripts and other non-C testcases. +- Added load generator tool, stress ( Amos Waterland ) +- Modified runalltests.sh to print default ( Manoj Iyer ) + settings +- Modified runalltests.sh to run LTP under stress ( Manoj Iyer ) + + + LTP-20021210 ------------ @@ -427,5 +536,6 @@ * lib/parse_opts.c (parse_opts): Initialize allocated string to prevent heap corruption. + |
|
From: <ro...@us...> - 2003-01-06 22:42:49
|
Update of /cvsroot/ltp/ltp/testcases/kernel/fs/ftest In directory sc8-pr-cvs1:/tmp/cvs-serv25579/ftest Log Message: Directory /cvsroot/ltp/ltp/testcases/kernel/fs/ftest added to the repository |
|
From: <iye...@us...> - 2003-01-06 22:11:44
|
Update of /cvsroot/ltp/ltp/testcases/commands/eject
In directory sc8-pr-cvs1:/tmp/cvs-serv12605
Modified Files:
eject-tests.sh
Log Message:
close the tray after the tests are done.
Index: eject-tests.sh
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/commands/eject/eject-tests.sh,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- eject-tests.sh 6 Jan 2003 20:49:35 -0000 1.7
+++ eject-tests.sh 6 Jan 2003 22:11:35 -0000 1.8
@@ -105,6 +105,8 @@
eject &>$LTPTMP/tst_eject.res || RC=$?
if [ $RC -eq 0 ]
then
+ # Close the tray if it is supported.
+ eject -t &>/dev/null
$LTPBIN/tst_resm TPASS "Test #2: eject succeded"
else
echo "Error code returned by eject: $RC" >> $LTPTMP/tst_eject.res \
@@ -191,5 +193,6 @@
#CLEANUP & EXIT
# remove all the temporary files created by this test.
rm -fr $LTPTMP/tst_eject* $LTPTMP/cdrom
+eject -t &>/dev/null
exit $TFAILCNT
|
|
From: <ro...@us...> - 2003-01-06 21:36:33
|
Update of /cvsroot/ltp/ltp/testcases/kernel/fs In directory sc8-pr-cvs1:/tmp/cvs-serv29646/testcases/kernel/fs Modified Files: Makefile Log Message: Added stream file I/O tests ported by Airong Zhang. Index: Makefile =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/fs/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile 4 Dec 2002 19:42:49 -0000 1.4 +++ Makefile 6 Jan 2003 21:35:57 -0000 1.5 @@ -1,4 +1,4 @@ -SUBDIRS = doio fs_inod fsstress fs_perms fsx-linux inode lftest linktest openfile proc +SUBDIRS = doio fs_inod fsstress fs_perms fsx-linux inode lftest linktest openfile proc stream all: @for i in $(SUBDIRS); do $(MAKE) -C $$i ; done |
|
From: <ro...@us...> - 2003-01-06 21:36:32
|
Update of /cvsroot/ltp/ltp/runtest In directory sc8-pr-cvs1:/tmp/cvs-serv29646/runtest Modified Files: fs Log Message: Added stream file I/O tests ported by Airong Zhang. Index: fs =================================================================== RCS file: /cvsroot/ltp/ltp/runtest/fs,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- fs 4 Dec 2002 19:47:12 -0000 1.10 +++ fs 6 Jan 2003 21:35:55 -0000 1.11 @@ -42,3 +42,8 @@ openfile01 openfile -f10 -t10 inode01 inode01 inode02 inode02 +stream01 stream01 +stream02 stream02 +stream03 stream03 +stream04 stream04 +stream05 stream05 |
|
From: <ro...@us...> - 2003-01-06 21:36:03
|
Update of /cvsroot/ltp/ltp/testcases/kernel/fs/stream
In directory sc8-pr-cvs1:/tmp/cvs-serv29646/testcases/kernel/fs/stream
Added Files:
Makefile stream01.c stream02.c stream03.c stream04.c
stream05.c
Log Message:
Added stream file I/O tests ported by Airong Zhang.
--- NEW FILE: Makefile ---
#
# 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 for the send(2) tests. #
###########################################################################
CFLAGS+= -I../../../../include -Wall -g
LOADLIBES+= -L../../../../lib -lltp
SRCS=$(wildcard *.c)
TARGETS=$(patsubst %.c,%,$(SRCS))
all: $(TARGETS)
install:
@for i in $(TARGETS) ; do ln -f $$i ../../../bin/$$i ; done ;
clean:
rm -f $(TARGETS)
--- NEW FILE: stream01.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
*/
/* ported from SPIE section2/filesuite/stream1.c, by Airong Zhang */
/*======================================================================
=================== TESTPLAN SEGMENT ===================
>KEYS: < freopen()
>WHAT: < 1) check that freopen substitutes the named file in place of stream.
>HOW: < 1) open a stream, write something to it, perform freopen and
< write some more. Check that second write to stream went to
< the file specified by freopen.
>BUGS: <
======================================================================*/
#include <stdio.h>
#include "test.h"
#include "usctest.h"
char *TCID = "stream01";
int TST_TOTAL = 1;
extern int Tst_count;
int local_flag;
#define PASSED 1
#define FAILED 0
extern int errno;
char progname[] = "stream01()" ;
char tempfile1[40]="";
char tempfile2[40]="";
/*--------------------------------------------------------------------*/
int main(int ac, char *av[])
{
FILE *stream;
char buf[10];
int i;
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
/*
* parse standard options
*/
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_resm(TBROK, "OPTION PARSING ERROR - %s", msg);
tst_exit();
/*NOTREACHED*/
}
local_flag = PASSED;
tst_tmpdir();
for (lc = 0; TEST_LOOPING(lc); lc++) {
sprintf(tempfile1, "stream011.%d", getpid());
sprintf(tempfile2, "stream012.%d", getpid());
/*--------------------------------------------------------------------*/
//block0:
if((stream=fopen(tempfile1,"a+")) == NULL) {
tst_resm(TFAIL,"\tfopen a+ failed\n");
tst_exit();
}
fwrite("a",1,1,stream);
if((stream=freopen(tempfile2,"a+",stream)) == NULL) {
tst_resm(TFAIL,"\tfreopen a+ failed\n");
tst_exit();
}
fwrite("a",1,1,stream);
fclose(stream);
/* now check that a single "a" is in each file */
if((stream=fopen(tempfile1,"r")) == NULL) {
tst_resm(TFAIL,"\tfopen r failed\n");
tst_exit();
}
else {
for(i=0; i<10; i++) buf[i]=0;
fread(buf,1,1,stream);
if((buf[0] != 'a') || (buf[1] != 0)) {
tst_resm(TFAIL,"\tbad contents in %s\n",tempfile1);
local_flag = FAILED;
}
fclose(stream);
}
if((stream=fopen(tempfile2,"r")) == NULL) {
tst_resm(TFAIL,"\tfopen r failed\n");
tst_exit();
}
else {
for(i=0; i<10; i++) buf[i]=0;
fread(buf,1,1,stream);
if((buf[0] != 'a') || (buf[1] != 0)) {
tst_resm(TFAIL,"\tbad contents in %s\n",tempfile2);
local_flag = FAILED;
}
fclose(stream);
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed.\n");
} else {
tst_resm(TFAIL, "Test failed.\n");
}
local_flag = PASSED;
/*--------------------------------------------------------------------*/
unlink(tempfile1);
unlink(tempfile2);
} /* end for */
tst_rmdir();
tst_exit();
return(0);
}
--- NEW FILE: stream02.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
*/
/* ported from SPIE section2/filesuite/stream2.c, by Airong Zhang */
/*======================================================================
=================== TESTPLAN SEGMENT ===================
>KEYS: < fseek() mknod() fopen()
>WHAT: < 1)
>HOW: < 1)
>BUGS: <
======================================================================*/
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "test.h"
#include "usctest.h"
char *TCID = "stream02";
int TST_TOTAL = 1;
extern int Tst_count;
int local_flag;
#define PASSED 1
#define FAILED 0
extern int errno;
char progname[] = "stream02()" ;
char tempfile1[40]="";
/*--------------------------------------------------------------------*/
int main(int ac, char *av[])
{
FILE *stream;
int fd;
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
/*
* parse standard options
*/
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_resm(TBROK, "OPTION PARSING ERROR - %s", msg);
tst_exit();
/*NOTREACHED*/
}
local_flag = PASSED;
tst_tmpdir();
for (lc = 0; TEST_LOOPING(lc); lc++) {
sprintf(tempfile1, "stream1.%d", getpid());
/*--------------------------------------------------------------------*/
//block0:
if(mknod(tempfile1,0,0010666) < 0) {
tst_resm(TFAIL,"\tmknod failed in block0\n");
local_flag = FAILED;
goto block1;
}
if((stream=fopen(tempfile1,"w+")) == NULL) {
tst_resm(TFAIL,"\tfopen w+ failed for pipe file\n");
local_flag = FAILED;
}
fclose(stream);
if((stream=fopen(tempfile1,"a+")) == NULL) {
tst_resm(TFAIL,"\tfopen a+ failed\n");
local_flag = FAILED;
}
fclose(stream);
unlink(tempfile1);
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block0.\n");
} else {
tst_resm(TFAIL, "Test failed in block0.\n");
}
local_flag = PASSED;
/*--------------------------------------------------------------------*/
block1 :
if(( fd = open("/dev/tty",O_WRONLY)) >= 0 )
{
close(fd);
if(( stream = fopen("/dev/tty","w"))==NULL) {
tst_resm(TFAIL,"\tfopen write failed for /dev/tty\n");
local_flag = FAILED;
}
fclose(stream);
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block1.\n");
} else {
tst_resm(TFAIL, "Test failed in block1.\n");
}
/*--------------------------------------------------------------------*/
} /* end for */
tst_rmdir();
tst_exit();
return(0);
}
--- NEW FILE: stream03.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
*/
/* ported from SPIE, section2/filesuite/stream3.c, by Airong Zhang */
/*======================================================================
=================== TESTPLAN SEGMENT ===================
>KEYS: < fseek() ftell()
>WHAT: < 1) Ensure ftell reports the correct current byte offset.
>HOW: < 1) Open a file, write to it, reposition the file pointer and
check it.
>BUGS: <
======================================================================*/
#define _XOPEN_SOURCE 500
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "test.h"
#include "usctest.h"
char *TCID = "stream03";
int TST_TOTAL = 1;
extern int Tst_count;
int local_flag;
#define PASSED 1
#define FAILED 0
extern int errno;
char progname[] = "stream03()" ;
char tempfile1[40]="";
long ftell();
/*--------------------------------------------------------------------*/
int main(int ac, char *av[])
{
FILE *stream;
char buf[30];
char *junk="abcdefghijklmnopqrstuvwxyz";
long pos;
off_t opos;
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
/*
* parse standard options
*/
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_resm(TBROK, "OPTION PARSING ERROR - %s", msg);
tst_exit();
/*NOTREACHED*/
}
local_flag = PASSED;
tst_tmpdir();
for (lc = 0; TEST_LOOPING(lc); lc++) {
sprintf(tempfile1, "stream03.%d", getpid());
/*--------------------------------------------------------------------*/
//block0:
if(creat(tempfile1,0666) < 0) {
tst_resm(TBROK,"\tcreat failed\n");
tst_exit();
}
if((stream=fopen(tempfile1,"a+")) == NULL) {
tst_resm(TBROK,"\tfopen a+ failed\n");
tst_exit();
}
/* make sure offset of zero at start */
pos=ftell(stream);
if ( pos != 0 ) {
tst_resm(TFAIL,"file pointer descrepancy 1");
local_flag = FAILED;
}
/* write something and check */
if(fwrite(junk,sizeof(*junk),strlen(junk),stream) == 0) {
tst_resm(TFAIL,"\tfwrite failed\n");
tst_exit();
}
pos=ftell(stream);
if (pos != strlen(junk) ) {
tst_resm(TFAIL, "strlen(junk):file pointer descrepancy 2");
local_flag = FAILED;
}
/* rewind and check */
rewind(stream);
pos=ftell(stream);
if ( pos != 0 ) {
tst_resm(TFAIL,0,"file pointer descrepancy 3");
local_flag = FAILED;
}
/* seek from current position and then check */
if (fseek(stream,strlen(junk),1) != 0) {
tst_resm(TFAIL,"\tfseek failed\n");
tst_exit();
}
pos=ftell(stream);
if (pos != strlen(junk) ) {
tst_resm(TFAIL,"strlen(junk),file pointer descrepancy 4");
local_flag = FAILED;
}
/* seek from end of file and then check */
if (fseek(stream,0,2) != 0) {
tst_resm(TFAIL,"\tfseek failed\n");
tst_exit();
}
pos=ftell(stream);
if (pos != strlen(junk) ) {
tst_resm(TFAIL,"strlen(junk),file pointer descrepancy 5");
local_flag = FAILED;
}
/* rewind with seek and then check */
if (fseek(stream,0,0) != 0) {
tst_resm(TFAIL,"\tfseek failed\n");
tst_exit();
}
pos=ftell(stream);
if (pos != 0 ) {
tst_resm(TFAIL,"file pointer descrepancy 6");
local_flag = FAILED;
}
/* read till EOF, do getc and then check ftell */
while (fgets (buf, 30, stream));
pos=ftell(stream);
(void) getc(stream);
pos=ftell(stream);
if (pos != strlen(junk) ) {
tst_resm(TFAIL,"strlen(junk),file pointer descrepancy 7");
local_flag = FAILED;
}
fclose(stream);
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block0.\n");
} else {
tst_resm(TFAIL, "Test failed in block0.\n");
}
local_flag = PASSED;
unlink(tempfile1);
/*--------------------------------------------------------------------*/
//block1:
if(creat(tempfile1,0666) < 0) {
tst_resm(TFAIL,"\tcreat failed\n");
tst_exit();
}
if((stream=fopen(tempfile1,"a+")) == NULL) {
tst_resm(TFAIL,"\tfopen a+ failed\n");
tst_exit();
}
/* make sure offset of zero at start */
opos=ftello(stream);
if ( opos != 0 ) {
tst_resm(TFAIL,"file pointer descrepancy 1");
local_flag = FAILED;
}
/* write something and check */
if(fwrite(junk,sizeof(*junk),strlen(junk),stream) == 0) {
tst_resm(TFAIL,"\tfwrite failed\n");
tst_exit();
}
opos=ftello(stream);
if (opos != strlen(junk) ) {
tst_resm(TFAIL,"strlen(junk),file pointer descrepancy 2");
local_flag = FAILED;
}
/* rewind and check */
rewind(stream);
opos=ftello(stream);
if ( opos != 0 ) {
tst_resm(TFAIL,"file pointer descrepancy 3");
local_flag = FAILED;
}
/* seek from current position and then check */
if (fseeko(stream, (off_t)strlen(junk), 1) != 0) {
tst_resm(TFAIL,"\tfseeko failed\n");
tst_exit();
}
opos=ftello(stream);
if (opos != strlen(junk) ) {
tst_resm(TFAIL,"strlen(junk),file pointer descrepancy 4");
local_flag = FAILED;
}
/* seek from end of file and then check */
if (fseeko(stream, (off_t)0, 2) != 0) {
tst_resm(TFAIL,"\tfseeko failed\n");
tst_exit();
}
opos=ftello(stream);
if (opos != strlen(junk) ) {
tst_resm(TFAIL,"strlen(junk),file pointer descrepancy 5");
local_flag = FAILED;
}
/* rewind with seek and then check */
if (fseeko(stream, (off_t)0, 0) != 0) {
tst_resm(TFAIL,"\tfseeko failed\n");
tst_exit();
}
opos=ftello(stream);
if (opos != 0 ) {
tst_resm(TFAIL,"file pointer descrepancy 6");
local_flag = FAILED;
}
/* read till EOF, do getc and then check ftello */
while (fgets (buf, 30, stream));
opos=ftello(stream);
(void) getc(stream);
opos=ftello(stream);
if (opos != strlen(junk) ) {
tst_resm(TFAIL,"strlen(junk),file pointer descrepancy 7");
local_flag = FAILED;
}
fclose(stream);
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block1.\n");
} else {
tst_resm(TFAIL, "Test failed in block1.\n");
}
/*--------------------------------------------------------------------*/
unlink(tempfile1);
} /* end for */
tst_rmdir();
tst_exit();
return(0);
}
--- NEW FILE: stream04.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
*/
/* Ported from SPIE, section2/iosuite/stream4.c, by Airong Zhang */
/*======================================================================
=================== TESTPLAN SEGMENT ===================
>KEYS: < fwrite() fread()
>WHAT: < 1) Ensure fwrite appends data to stream.
< 2) Ensure fread and fwrite return values are valid.
>HOW: < 1) Open a file, write to it, and then check it.
< 2) Fwrite a know quanity, check return value.
< Fread a know quanity, check return value.
>BUGS: <
======================================================================*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "test.h"
#include "usctest.h"
char *TCID = "stream04";
int TST_TOTAL = 1;
extern int Tst_count;
int local_flag;
#define PASSED 1
#define FAILED 0
extern int errno;
char progname[] = "stream04()" ;
char tempfile1[40]="";
long ftell();
/*--------------------------------------------------------------------*/
int main(int ac, char *av[])
{
FILE *stream;
char *junk="abcdefghijklmnopqrstuvwxyz";
char *inbuf;
int ret;
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
/*
* parse standard options
*/
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_resm(TBROK, "OPTION PARSING ERROR - %s", msg);
tst_exit();
/*NOTREACHED*/
}
tst_tmpdir();
for (lc = 0; TEST_LOOPING(lc); lc++) {
local_flag = PASSED;
sprintf(tempfile1, "stream04.%d", getpid());
/*--------------------------------------------------------------------*/
//block0:
if(creat(tempfile1,0666) < 0) {
tst_resm(TFAIL,"\tcreat failed\n");
tst_exit();
}
if((stream=fopen(tempfile1,"a+")) == NULL) {
tst_resm(TFAIL,"\tfopen a+ failed\n");
tst_exit();
}
/* write something and check */
if((ret=fwrite(junk,sizeof(*junk),strlen(junk),stream)) == 0) {
tst_resm(TFAIL,"\tfwrite failed\n");
tst_exit();
}
if(ret != strlen(junk)) {
tst_resm(TFAIL,"strlen(junk),return value from fwrite");
local_flag = FAILED;
}
fclose(stream);
if((stream=fopen(tempfile1,"r+")) == NULL) {
tst_resm(TFAIL,"\tfopen r+ failed\n");
tst_exit();
}
if ( (inbuf=(char *)malloc(strlen(junk))) == 0) {
tst_resm(TBROK, "test failed because of malloc\n");
tst_exit();
}
if((ret=fread(inbuf,sizeof(*junk),strlen(junk),stream)) == 0) {
tst_resm(TFAIL,"\tfread failed\n");
tst_exit();
}
if(ret != strlen(junk)) {
tst_resm(TFAIL,"strlen(junk),return value from fread");
local_flag = FAILED;
}
fclose(stream);
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed.\n");
} else {
tst_resm(TFAIL, "Test failed.\n");
}
/*--------------------------------------------------------------------*/
unlink(tempfile1);
} /* end for */
tst_rmdir();
tst_exit();
return(0);
}
--- NEW FILE: stream05.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
*/
/* ported from SPIE, section2/filesuite/stream.c, by Airong Zhang */
/*======================================================================
=================== TESTPLAN SEGMENT ===================
>KEYS: < ferror() feof() clearerr() fileno()
>WHAT: < 1) check that ferror returns zero
< 2) check fileno returns valid file descriptor
< 3) check that feof returns zero (nonzero) appropriately
< 4) check that clearerr resets EOF indicator.
>HOW: < 1) open a stream and immediately execute ferror
< 2) use the file des returned from fileno to read a file
< written with stream - compare actual vs expected.
< 3) open stream and ensure feof returns zero, read to end of
< file and ensure feof returns non-zero.
< 4) after 3) above use clearerr and then use feof to ensure
< clearerr worked
>BUGS: <
======================================================================*/
#include <unistd.h>
#include <stdio.h>
#include "test.h"
#include "usctest.h"
char *TCID = "stream05";
int TST_TOTAL = 1;
extern int Tst_count;
int local_flag;
#define PASSED 1
#define FAILED 0
extern int errno;
char progname[] = "stream05()" ;
char tempfile[40]="";
/*--------------------------------------------------------------------*/
int main(int ac, char *av[])
{
FILE *stream;
char buf[10];
int nr,fd;
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
/*
* parse standard options
*/
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_resm(TBROK, "OPTION PARSING ERROR - %s", msg);
tst_exit();
/*NOTREACHED*/
}
tst_tmpdir();
local_flag = PASSED;
for (lc = 0; TEST_LOOPING(lc); lc++) {
local_flag = PASSED;
sprintf(tempfile, "stream05.%d", getpid());
/*--------------------------------------------------------------------*/
//block0:
if((stream=fopen(tempfile,"a+")) == NULL) {
tst_resm(TFAIL,"\tfopen a+ failed\n");
tst_exit();
}
fprintf(stream,"a");
fclose(stream);
if((stream=fopen(tempfile,"r+")) == NULL) {
tst_resm(TFAIL,"\tfopen r+ failed\n");
tst_exit();
}
/* check that ferror returns zero */
if(ferror(stream) != 0) {
tst_resm(TFAIL, "\tferror did not return zero\n");
local_flag = FAILED;
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block0.\n");
} else {
tst_resm(TFAIL, "Test failed in block0.\n");
}
local_flag = PASSED;
/*--------------------------------------------------------------------*/
//block1:
/* check that fileno returns valid file descriptor */
fd=fileno(stream);
if((nr=read(fd,buf,1)) < 0) {
tst_resm(TFAIL, "\tread failed\n");
tst_exit();
}
if(nr != 1) {
tst_resm(TFAIL,"read did not read right number");
local_flag = FAILED;
}
if(buf[0] != 'a') {
tst_resm(TFAIL, "\tread returned bad values\n");
local_flag = FAILED;
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block1.\n");
} else {
tst_resm(TFAIL, "Test failed in block1.\n");
}
local_flag = PASSED;
/*--------------------------------------------------------------------*/
//block2:
/* read to EOF and ensure feof returns non-zero */
fclose(stream);
if((stream=fopen(tempfile,"r+")) == NULL) {
tst_resm(TFAIL,"\tfopen r+ failed\n");
tst_exit();
}
if(feof(stream) != 0) {
tst_resm(TFAIL, "\tfeof returned non-zero when it should not\n");
local_flag = FAILED;
}
fread(buf,1,2,stream); /* read to EOF */
if(feof(stream) == 0) {
tst_resm(TFAIL, "\tfeof returned zero when it should not\n");
local_flag = FAILED;
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block2.\n");
} else {
tst_resm(TFAIL, "Test failed in block2.\n");
}
local_flag = PASSED;
/*--------------------------------------------------------------------*/
//block3:
/* ensure clearerr works */
clearerr(stream);
if(feof(stream) != 0) {
tst_resm(TFAIL, "\tclearerr failed\n");
local_flag = FAILED;
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block3.\n");
} else {
tst_resm(TFAIL, "Test failed in block3.\n");
}
local_flag = PASSED;
/*--------------------------------------------------------------------*/
//block4:
/* test fopen "b" flags -- should be allowed but ignored */
(void) fclose(stream);
if ((stream = fopen(tempfile, "rb")) == NULL) {
tst_resm(TFAIL, "\tfopen rb failed\n");
tst_exit();
}
(void) fclose(stream);
if ((stream = fopen(tempfile, "wb")) == NULL) {
tst_resm(TFAIL, "\tfopen wb failed\n");
tst_exit();
}
(void) fclose(stream);
if ((stream = fopen(tempfile, "ab")) == NULL) {
tst_resm(TFAIL, "\tfopen ab failed\n");
tst_exit();
}
(void) fclose(stream);
if ((stream = fopen(tempfile, "rb+")) == NULL) {
tst_resm(TFAIL, "\tfopen rb+ failed\n");
tst_exit();
}
(void) fclose(stream);
if ((stream = fopen(tempfile, "wb+")) == NULL) {
tst_resm(TFAIL, "\tfopen wb+ failed\n");
tst_exit();
}
(void) fclose(stream);
if ((stream = fopen(tempfile, "ab+")) == NULL) {
tst_resm(TFAIL, "\tfopen ab+ failed\n");
tst_exit();
}
(void) fclose(stream);
tst_resm(TPASS, "Test passed in block4.\n");
/*--------------------------------------------------------------------*/
unlink(tempfile);
} /* end for */
tst_rmdir();
tst_exit();
/* NOTREACHED */
return(0);
}
|
|
From: <ro...@us...> - 2003-01-06 21:33:03
|
Update of /cvsroot/ltp/ltp/testcases/kernel/fs/stream In directory sc8-pr-cvs1:/tmp/cvs-serv28636/stream Log Message: Directory /cvsroot/ltp/ltp/testcases/kernel/fs/stream added to the repository |
|
From: <iye...@us...> - 2003-01-06 20:49:39
|
Update of /cvsroot/ltp/ltp/testcases/commands/eject
In directory sc8-pr-cvs1:/tmp/cvs-serv9069
Modified Files:
eject-tests.sh
Log Message:
Modified Test #3 to clean up properly
Index: eject-tests.sh
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/commands/eject/eject-tests.sh,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- eject-tests.sh 6 Jan 2003 20:47:58 -0000 1.6
+++ eject-tests.sh 6 Jan 2003 20:49:35 -0000 1.7
@@ -184,11 +184,12 @@
then
cp $LTPTMP/fstab.bak /etc/fstab &>/dev/null
else
- $LTPBIN/tst_res TINFO "Test #3: Could not restore /etc/fstab coz"
- $LTPBIN/tst_res TINFO "Test #3: backup file $LTPTMP/fstab.bak was lost!"
+ $LTPBIN/tst_resm TINFO "Test #3: Could not restore /etc/fstab coz"
+ $LTPBIN/tst_resm TINFO "Test #3: backup file $LTPTMP/fstab.bak was lost!"
fi
#CLEANUP & EXIT
# remove all the temporary files created by this test.
-rm -f $LTPTMP/tst_eject*
+rm -fr $LTPTMP/tst_eject* $LTPTMP/cdrom
+
exit $TFAILCNT
|
|
From: <iye...@us...> - 2003-01-06 20:48:03
|
Update of /cvsroot/ltp/ltp/testcases/commands/eject
In directory sc8-pr-cvs1:/tmp/cvs-serv7749
Modified Files:
eject-tests.sh
Log Message:
- Changed tst_brkm to use correct parameters.
- Check if $LTPTMP/cdrom directory exists before creating it.
- Corrected code to check if return code is not 0 which indicated failure.
- fixed code to add $LTPTMP/cdrom to /etc/fstab
Index: eject-tests.sh
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/commands/eject/eject-tests.sh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- eject-tests.sh 4 Jan 2003 05:03:24 -0000 1.5
+++ eject-tests.sh 6 Jan 2003 20:47:58 -0000 1.6
@@ -27,6 +27,13 @@
# History: Jan 01 2003 - Created - Manoj Iyer.
# - Added - Test #2.
# Jan 03 2003 - Added - Test #3.
+# Jan 06 2003 - Modified - Test #3.
+# - Changed tst_brk to use correct parameters.
+# - Check if $LTPTMP/cdrom directory exists before
+# creating it.
+# - Corrected code to check if return code is not 0
+# which indicated failure.
+# - fixed code to add $LTPTMP/cdrom to /etc/fstab
#
#! /bin/sh
@@ -121,16 +128,35 @@
$LTPBIN/tst_resm TINFO "Test #3: is currently mounted."
cp /etc/fstab $LTPTMP/fstab.bak &>/dev/null
-mkdir $LTPTMP/cdrom &>/dev/null
-echo "/dev/cdrom $LTPTMP/cdrom iso9660 defaults,ro,user,noauto 0 0" \
- >> /etc/fstab 2>/dev/null
+if [ -d $LTPTMP/cdrom ]
+then
+ $LTPBIN/tst_resm TINFO \
+ "Test #3: test cdrom mount point $LTPTMP/cdrom exists. Skip creation"
+else
+ mkdir -p $LTPTMP/cdrom &>$LTPTMP/tst_eject.out || RC=$?
+ if [ $RC -ne 0 ]
+ then
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_eject.out NULL \
+ "Test #3: failed to make directory $LTPTMP/cdrom. Reason:"
+ TFAILCNT=$((TFAILCNT+1))
+ fi
+fi
+
+echo "/dev/cdrom $LTPTMP/cdrom iso9660 defaults,ro,user,noauto 0 0" >>/etc/fstab 2>$LTPTMP/tst_eject.out || RC=$?
+if [ $RC -ne 0 ]
+then
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_eject.out NULL \
+ "Test #3: failed adding $LTPTMP/cdrom to /etc/fstab. Reason:"
+ TFAILCNT=$((TFAILCNT+1))
+fi
mount $LTPTMP/cdrom &>$LTPTMP/tst_eject.out || RC=$?
-if [ $RC -eq 0 ]
+if [ $RC -ne 0 ]
then
echo ".Failed to mount $LTPTMP/cdrom." >> $LTPTMP/tst_eject.out 2>/dev/null
- $LTPBIN/tst_brk TBROK tst_eject.out "Test #3: mount failed. Reason:"
+ $LTPBIN/tst_brk TBROK $LTPTMP/tst_eject.out NULL \
+ "Test #3: mount failed. Reason:"
TFAILCNT=$((TFAILCNT+1))
else
eject &>$LTPTMP/tst_eject.out || RC=$?
|
|
From: <ro...@us...> - 2003-01-06 20:43:54
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/open
In directory sc8-pr-cvs1:/tmp/cvs-serv6466/testcases/kernel/syscalls/open
Added Files:
open10.c
Log Message:
Added open10 test ported by Airong Zhang
--- NEW FILE: open10.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
* open10.c - Verifies that the group ID and setgid bit are
* set correctly when a new file is created using open.
* (ported from SPIE, section2/iosuite/open5.c, by
* Airong Zhang)
*
* CALLS
* open
*
* ALGORITHM
* Create two directories, one with the group ID of this process
* and the setgid bit not set, and the other with a group ID
* other than that of this process and with the setgid bit set.
* In each directory, create a file with and without the setgid
* bit set in the creation modes. Verify that the modes and group
* ID are correct on each of the 4 files.
* As root, create a file with the setgid bit on in the
* directory with the setgid bit.
* This tests the SVID3 create group semantics.
*
* USAGE
* open10
*
* RESTRICTIONS
*
*/
#include <stdio.h> /* needed by testhead.h */
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <errno.h>
#include <grp.h>
#include <pwd.h>
#include "usctest.h"
#include "test.h"
char *TCID = "open10";
int TST_TOTAL = 1;
extern int Tst_count;
int local_flag;
#define PASSED 1
#define FAILED 0
int local_flag;
#define MODE_RWX S_IRWXU | S_IRWXG | S_IRWXO
#define MODE_SGID S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO
#define DIR_A_TEMP "open10.testdir.A.%d"
#define DIR_B_TEMP "open10.testdir.B.%d"
#define SETGID "setgid"
#define NOSETGID "nosetgid"
#define ROOT_SETGID "root_setgid"
#define MSGSIZE 150
extern int errno;
char progname[]= "open10()";
/*--------------------------------------------------------------*/
main (int ac, char *av[])
{
int ret;
struct stat buf;
struct group *group;
struct passwd *user1;
char DIR_A[MSGSIZE], DIR_B[MSGSIZE];
char setgid_A[MSGSIZE], nosetgid_A[MSGSIZE];
char setgid_B[MSGSIZE], nosetgid_B[MSGSIZE], root_setgid_B[MSGSIZE];
gid_t group1_gid, group2_gid, mygid;
uid_t save_myuid, user1_uid;
pid_t mypid;
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
int fail_count = 0;
/*
* parse standard options
*/
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_resm(TBROK, "OPTION PARSING ERROR - %s", msg);
tst_exit();
/*NOTREACHED*/
}
if (issu() != 0) {
tst_resm(TINFO, "\nMust be root to run this test.\n");
tst_exit();
}
for (lc = 0; TEST_LOOPING(lc); lc++) {
local_flag = PASSED;
save_myuid = getuid();
mypid = getpid();
sprintf(DIR_A, DIR_A_TEMP, mypid);
sprintf(DIR_B, DIR_B_TEMP, mypid);
sprintf(setgid_A, "%s/%s", DIR_A, SETGID);
sprintf(nosetgid_A, "%s/%s", DIR_A, NOSETGID);
sprintf(setgid_B, "%s/%s", DIR_B, SETGID);
sprintf(nosetgid_B, "%s/%s", DIR_B, NOSETGID);
sprintf(root_setgid_B, "%s/%s", DIR_B, ROOT_SETGID);
/* Get the uid of user1 */
if ((user1 = getpwnam("nobody")) == NULL) {
tst_resm(TBROK, "nobody not in /etc/passwd\n");
tst_exit();
}
user1_uid = user1->pw_uid;
/*
* Get the group IDs of group1 and group2.
*/
if ((group = getgrnam("nobody")) == NULL) {
tst_resm(TBROK, "nobody not in /etc/group\n");
tst_exit();
}
group1_gid = group->gr_gid;
if ((group = getgrnam("bin")) == NULL) {
tst_resm(TBROK, "bin not in /etc/group\n");
}
group2_gid = group->gr_gid;
/*--------------------------------------------------------------*/
/* Block0: Set up the parent directories */
/*--------------------------------------------------------------*/
block0:
/*
* Create a directory with group id the same as this process
* and with no setgid bit.
*/
if ((ret = mkdir(DIR_A, MODE_RWX)) < 0) {
tst_resm(TFAIL, "Creation dir of %s failed", DIR_A);
local_flag = FAILED;
}
if ((ret = chown(DIR_A, user1_uid, group2_gid)) < 0) {
tst_resm(TFAIL, "Chown of %d failed",DIR_A);
local_flag = FAILED;
}
if ((ret = stat(DIR_A, &buf)) < 0) {
tst_resm(TFAIL,"Stat of %s failed\n",DIR_A);
local_flag = FAILED;
}
/* Verify modes */
if (buf.st_mode & S_ISGID) {
tst_resm(TFAIL, "%s: Incorrect modes, setgid bit set\n",
DIR_A);
local_flag = FAILED;
}
/* Verify group ID */
if (buf.st_gid != group2_gid) {
tst_resm(TFAIL, "%s: Incorrect group", DIR_A);
tst_resm(TINFO,"got %ld and %ld\n",buf.st_gid, group2_gid);
local_flag = FAILED;
}
/*
* Create a directory with group id different from that of
* this process and with the setgid bit set.
*/
if ((ret = mkdir(DIR_B, MODE_RWX)) < 0) {
tst_resm(TFAIL, "Creation of %s failed", DIR_B);
local_flag = FAILED;
}
if ((ret = chown(DIR_B, user1_uid, group2_gid)) < 0) {
tst_resm(TFAIL, "Chown of %s failed", DIR_B);
local_flag = FAILED;
}
if ((ret = chmod(DIR_B, MODE_SGID)) < 0) {
tst_resm(TFAIL, "Chmod of %s failed", DIR_B);
local_flag = FAILED;
}
if ((ret = stat(DIR_B, &buf)) < 0) {
tst_resm(TFAIL, "Stat of %s failed", DIR_B);
local_flag = FAILED;
}
/* Verify modes */
if (!(buf.st_mode & S_ISGID)) {
tst_resm(TFAIL, "%s: Incorrect modes, setgid bit not set\n",
DIR_B);
local_flag = FAILED;
}
/* Verify group ID */
if (buf.st_gid != group2_gid) {
tst_resm(TFAIL, "%s: Incorrect group", DIR_B);
tst_resm(TINFO, "got %ld and %ld\n",buf.st_gid, group2_gid);
local_flag = FAILED;
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block0.\n");
} else {
tst_resm(TFAIL, "Test failed in block0.\n");
fail_count++;
}
local_flag = PASSED;
/*--------------------------------------------------------------*/
/* Block1: Create two files in testdir.A, one with the setgid */
/* bit set in the creation modes and the other without. */
/* Both should inherit the group ID of the process and */
/* maintain the setgid bit as specified in the creation */
/* modes.
/*--------------------------------------------------------------*/
block1:
/*
* Now become user1, group1
*/
if ((ret = setgid(group1_gid)) < 0) {
tst_resm(TINFO, 0, "Unable to set process group ID to group1");
}
if ((ret = setreuid(-1, user1_uid)) < 0) {
tst_resm(TINFO, 0, "Unable to set process uid to user1");
}
mygid = getgid();
/*
* Create the file with setgid not set
*/
if ((ret = open(nosetgid_A, O_CREAT|O_EXCL|O_RDWR, MODE_RWX)) < 0) {
tst_resm(TFAIL, "Creation of %s failed", nosetgid_A);
local_flag = FAILED;
}
if ((ret = stat(nosetgid_A, &buf)) < 0) {
tst_resm(TFAIL, "Stat of %s failed", nosetgid_A);
local_flag = FAILED;
}
/* Verify modes */
if (buf.st_mode & S_ISGID) {
tst_resm(TFAIL, "%s: Incorrect modes, setgid bit set", nosetgid_A);
local_flag = FAILED;
}
/* Verify group ID */
if (buf.st_gid != mygid) {
tst_resm(TFAIL, "%s: Incorrect group", nosetgid_A);
tst_resm(TINFO, "got %ld and %ld\n",buf.st_gid, mygid);
local_flag = FAILED;
}
/*
* Create the file with setgid set
*/
if ((ret = open(setgid_A, O_CREAT|O_EXCL|O_RDWR, MODE_SGID)) < 0) {
tst_resm(TFAIL, "Creation of %s failed", setgid_A);
local_flag = FAILED;
}
if ((ret = stat(setgid_A, &buf)) < 0) {
tst_resm(TFAIL, "Stat of %s failed", setgid_A);
local_flag = FAILED;
}
/* Verify modes */
if (!(buf.st_mode & S_ISGID)) {
tst_resm(TFAIL, "%s: Incorrect modes, setgid bit not set\n",
setgid_A);
local_flag = FAILED;
}
/* Verify group ID */
if (buf.st_gid != mygid) {
tst_resm(TFAIL, "%s: Incorrect group", setgid_A);
tst_resm(TINFO, "got %ld and %ld\n",buf.st_gid, mygid);
local_flag = FAILED;
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block1.\n");
} else {
tst_resm(TFAIL, "Test failed in block1.\n");
fail_count++;
}
local_flag = PASSED;
/*--------------------------------------------------------------*/
/* Block2: Create two files in testdir.B, one with the setgid */
/* bit set in the creation modes and the other without. */
/* Both should inherit the group ID of the parent I/
/* directory, group2. Either file should have the segid*/
/* bit set in the modes. */
/*--------------------------------------------------------------*/
block2:
/*
* Create the file with setgid not set
*/
if ((ret = open(nosetgid_B, O_CREAT|O_EXCL|O_RDWR, MODE_RWX)) < 0) {
tst_resm(TFAIL, "Creation of %s failed", nosetgid_B);
local_flag = FAILED;
}
if ((ret = stat(nosetgid_B, &buf)) < 0) {
tst_resm(TFAIL, "Stat of %s failed", nosetgid_B);
local_flag = FAILED;
}
/* Verify modes */
if (buf.st_mode & S_ISGID) {
tst_resm(TFAIL, "%s: Incorrect modes, setgid bit should be set\n",
nosetgid_B);
local_flag = FAILED;
}
/* Verify group ID */
if (buf.st_gid != group2_gid) {
tst_resm(TFAIL, "%s: Incorrect group", nosetgid_B);
tst_resm(TINFO, "got %ld and %ld\n",buf.st_gid, group2_gid);
local_flag = FAILED;
}
/*
* Create the file with setgid set
*/
if ((ret = open(setgid_B, O_CREAT|O_EXCL|O_RDWR, MODE_SGID)) < 0) {
tst_resm(TFAIL, "Creation of %s failed", setgid_B);
local_flag = FAILED;
}
if ((ret = stat(setgid_B, &buf)) < 0) {
tst_resm(TFAIL, "Stat of %s failed", setgid_B);
local_flag = FAILED;
}
/* Verify group ID */
if (buf.st_gid != group2_gid) {
tst_resm(TFAIL, "%s: Incorrect group", setgid_B);
tst_resm(TINFO,"got %ld and %ld\n",buf.st_gid, group2_gid);
local_flag = FAILED;
}
/* Verify modes */
if (!(buf.st_mode & S_ISGID)) {
tst_resm(TFAIL, "%s: Incorrect modes, setgid bit not set\n",
setgid_B);
local_flag = FAILED;
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block2.\n");
} else {
tst_resm(TFAIL, "Test failed in block2.\n");
fail_count++;
}
local_flag = PASSED;
/*--------------------------------------------------------------*/
/* Block3: Create a file in testdir.B, with the setgid bit set */
/* in the creation modes and do so as root. The file */
/* should inherit the group ID of the parent directory, */
/* group2 and should have the setgid bit set. */
/*--------------------------------------------------------------*/
block3:
/* Become root again */
if ((ret = setreuid(-1, save_myuid)) < 0) {
tst_resm(TFAIL, 0, "Changing back to root failed");
local_flag = FAILED;
}
/* Create the file with setgid set */
if ((ret = open(root_setgid_B, O_CREAT|O_EXCL|O_RDWR,
MODE_SGID)) < 0) {
tst_resm(TFAIL, "Creation of %s failed", root_setgid_B);
local_flag = FAILED;
}
if ((ret = stat(root_setgid_B, &buf)) < 0) {
tst_resm(TFAIL, "Stat of %s failed", root_setgid_B);
local_flag = FAILED;
}
/* Verify modes */
if (!(buf.st_mode & S_ISGID)) {
tst_resm(TFAIL, "%s: Incorrect modes, setgid bit not set\n",
root_setgid_B);
local_flag = FAILED;
}
/* Verify group ID */
if (buf.st_gid != group2_gid) {
tst_resm(TFAIL, "%s: Incorrect group", root_setgid_B);
tst_resm(TINFO, "got %ld and %ld\n",buf.st_gid, group2_gid);
local_flag = FAILED;
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block3.\n");
} else {
tst_resm(TFAIL, "Test failed in block3.\n");
fail_count++;
}
/*--------------------------------------------------------------*/
/* Clean up any files created by test before call to anyfail. */
/* Remove the directories.
/*--------------------------------------------------------------*/
if ((ret = unlink(setgid_A)) < 0) {
tst_resm(TINFO, "Warning: %s not removed", setgid_A);
}
if ((ret = unlink(nosetgid_A)) < 0) {
tst_resm(TINFO, "Warning: %s not removed", nosetgid_A);
}
if ((ret = rmdir(DIR_A)) < 0) {
tst_resm(TINFO, "Warning: %s not removed", DIR_A);
}
if ((ret = unlink(setgid_B)) < 0) {
tst_resm(TINFO, "Warning: %s not removed", setgid_B);
}
if ((ret = unlink(root_setgid_B)) < 0) {
tst_resm(TINFO, "Warning: %s not removed", root_setgid_B);
}
if ((ret = unlink(nosetgid_B)) < 0) {
tst_resm(TINFO, "Warning: %s not removed", nosetgid_B);
}
if ((ret = rmdir(DIR_B)) < 0) {
tst_resm(TINFO, "Warning: %s not removed", DIR_B);
printf("errno is %d\n", errno);
}
if (fail_count == 0 ) {
tst_resm(TPASS, "Test passed.\n");
} else {
tst_resm(TFAIL, "Test failed because of above failures.\n");
}
}
tst_exit();
}
issu() {
int uid;
uid = (-1);
uid = geteuid();
if (uid == (-1)) {
fprintf(stderr,"geteuid: failed in issu()");
return(-1);
}
if ( uid == 0) {
return(0);
} else {
fprintf(stderr,"*** NOT SUPERUSER must be root %s\n",progname);
return(uid);
}
}
|
|
From: <ro...@us...> - 2003-01-06 20:43:52
|
Update of /cvsroot/ltp/ltp/runtest In directory sc8-pr-cvs1:/tmp/cvs-serv6466/runtest Modified Files: syscalls Log Message: Added open10 test ported by Airong Zhang Index: syscalls =================================================================== RCS file: /cvsroot/ltp/ltp/runtest/syscalls,v retrieving revision 1.106 retrieving revision 1.107 diff -u -d -r1.106 -r1.107 --- syscalls 6 Jan 2003 17:23:07 -0000 1.106 +++ syscalls 6 Jan 2003 20:43:47 -0000 1.107 @@ -463,6 +463,7 @@ open07 open07 open08 open08 open09 open09 +open10 open10 pathconf01 pathconf01 |
|
From: <ro...@us...> - 2003-01-06 20:32:45
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/fmtmsg
In directory sc8-pr-cvs1:/tmp/cvs-serv2797
Modified Files:
fmtmsg01.c
Log Message:
Corrected some compile warnings, and changed the expected messages a bit.
Index: fmtmsg01.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/fmtmsg/fmtmsg01.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- fmtmsg01.c 31 Dec 2002 20:54:14 -0000 1.2
+++ fmtmsg01.c 6 Jan 2003 20:32:39 -0000 1.3
@@ -68,12 +68,12 @@
char ch;
char buf[80];
-char * str1 = "SPIE:fmtmsg: INFO: SPIE fmtmsg() test1 message, NOT an error";
-char * str2 = "TO FIX: This is correct output, no action needed SPIE:msg:001";
-char * str3 = "SPIE:fmtmsg: SPIE_TEST: SPIE fmtmsg() test2 message, NOT an error";
-char * str4 = "TO FIX: This is correct output, no action needed SPIE:msg:002";
+char * str1 = "LTP:fmtmsg: INFO: LTP fmtmsg() test1 message, NOT an error";
+char * str2 = "TO FIX: This is correct output, no action needed LTP:msg:001";
+char * str3 = "LTP:fmtmsg: LTP_TEST: LTP fmtmsg() test2 message, NOT an error";
+char * str4 = "TO FIX: This is correct output, no action needed LTP:msg:002";
-clearbuf()
+void clearbuf()
{
int i;
for (i=0; i<80; i++)
@@ -81,22 +81,22 @@
}
/*--------------------------------------------------------------*/
-main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
int fd, ret_val;
FILE *fp;
setup(); /* temp file is now open */
/*--------------------------------------------------------------*/
-block0: blenter();
+ blenter();
/* Check that system SEV_LEVEL output is correct */
close(2); /* redirect stderr to file */
fd = creat( "fmtfile", 0644);
- ret_val = fmtmsg(MM_PRINT|MM_SOFT,"SPIE:fmtmsg", MM_INFO,
- "SPIE fmtmsg() test1 message, NOT an error",
- "This is correct output, no action needed","SPIE:msg:001");
+ ret_val = fmtmsg(MM_PRINT|MM_SOFT,"LTP:fmtmsg", MM_INFO,
+ "LTP fmtmsg() test1 message, NOT an error",
+ "This is correct output, no action needed","LTP:msg:001");
close(fd);
if (ret_val != 0) {
@@ -132,7 +132,7 @@
blexit();
/*--------------------------------------------------------------*/
-block1: blenter();
+ blenter();
/* Check that a system defined SEV_LEVEL cannot get redefined */
@@ -145,12 +145,12 @@
blexit();
/*--------------------------------------------------------------*/
-block2: blenter();
+ blenter();
/* Check that we can define our own */
/* SEV_LEVEL and output is correct */
- ret_val = addseverity(5, "SPIE_TEST");
+ ret_val = addseverity(5, "LTP_TEST");
if (ret_val != MM_OK) {
fprintf(temp, "addseverity returned %d, expected MM_OK\n",
ret_val);
@@ -159,9 +159,9 @@
close(2); /* redirect stderr to file */
fd = creat( "fmtfile", 0644);
- ret_val = fmtmsg(MM_PRINT|MM_HARD|MM_OPSYS,"SPIE:fmtmsg", 5,
- "SPIE fmtmsg() test2 message, NOT an error",
- "This is correct output, no action needed","SPIE:msg:002");
+ ret_val = fmtmsg(MM_PRINT|MM_HARD|MM_OPSYS,"LTP:fmtmsg", 5,
+ "LTP fmtmsg() test2 message, NOT an error",
+ "This is correct output, no action needed","LTP:msg:002");
close(fd);
if (ret_val != 0) {
@@ -199,13 +199,13 @@
blexit();
/*--------------------------------------------------------------*/
-block3: blenter();
+ blenter();
/* Test result of writing to /dev/console */
- ret_val = fmtmsg(MM_CONSOLE|MM_HARD|MM_OPSYS,"SPIE:fmtmsg", 5,
- "SPIE fmtmsg() test3 message, NOT an error",
- "This is correct output, no action needed","SPIE:msg:003");
+ ret_val = fmtmsg(MM_CONSOLE|MM_HARD|MM_OPSYS,"LTP:fmtmsg", 5,
+ "LTP fmtmsg() test3 message, NOT an error",
+ "This is correct output, no action needed","LTP:msg:003");
if (ret_val != MM_OK) {
fprintf(temp, "fmtmsg returned %d, expected MM_OK\n", ret_val);
fprintf(temp, "failed to write to console\n\n");
@@ -217,6 +217,7 @@
/* Clean up any files created by test before call to anyfail. */
anyfail(); /* THIS CALL DOES NOT RETURN - EXITS!! */
+ return(0);
}
/*--------------------------------------------------------------*/
@@ -228,6 +229,7 @@
(local_flag == FAILED)? tst_resm(TFAIL, "Test failed\n"): tst_resm(TPASS, "Test passed\n");
tst_rmdir();
tst_exit();
+ return(0);
}
|
|
From: <ro...@us...> - 2003-01-06 17:23:45
|
Update of /cvsroot/ltp/ltp/runtest In directory sc8-pr-cvs1:/tmp/cvs-serv26415/runtest Modified Files: syscalls Log Message: Added additional pipe() tests ported by Paul Larson. Index: syscalls =================================================================== RCS file: /cvsroot/ltp/ltp/runtest/syscalls,v retrieving revision 1.105 retrieving revision 1.106 diff -u -d -r1.105 -r1.106 --- syscalls 3 Jan 2003 21:00:43 -0000 1.105 +++ syscalls 6 Jan 2003 17:23:07 -0000 1.106 @@ -474,8 +474,12 @@ personality02 personality02 pipe01 pipe01 +pipe02 pipe02 +pipe03 pipe03 +pipe04 pipe04 pipe05 pipe05 pipe06 pipe06 +pipe07 pipe07 pipe08 pipe08 pipe09 pipe09 pipe10 pipe10 |
|
From: <ro...@us...> - 2003-01-06 17:23:31
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/pipe
In directory sc8-pr-cvs1:/tmp/cvs-serv26415/testcases/kernel/syscalls/pipe
Added Files:
pipe02.c pipe03.c pipe04.c pipe07.c
Log Message:
Added additional pipe() tests ported by Paul Larson.
--- NEW FILE: pipe02.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
* pipe02.c
*
* DESCRIPTION
* Check that if a child has a "broken pipe", this information
* is transmitted to the waiting parent.
*
* ALGORITHM
* 1. Create a pipe, fork child
* 2. Child writes to pipe, parent reads to verify the pipe is working
* 3. Parent closes the read end of the pipe, child writes to it
* 4. Parent checks to see that child was terminated with SIGPIPE
*
* USAGE: <for command-line>
* pipe02 [-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.
*
* HISTORY
* 12/2002 Ported by Paul Larson
*
* RESTRICTIONS
* None
*/
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/wait.h>
#include <sys/types.h>
#include "test.h"
#include "usctest.h"
char *TCID = "pipe02";
int TST_TOTAL = 1;
extern int Tst_count;
int usrsig;
void setup(void);
void cleanup(void);
void catch_usr2(int);
int main(int ac, char **av)
{
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
int pp[2]; /* pipe descriptor */
char rbuf[BUFSIZ], wbuf[BUFSIZ];
int pid, ret, len, rlen, status;
int sig = 0;
usrsig = 0;
/* parse standard options */
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);
/*NOTREACHED*/
}
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping */
Tst_count = 0;
ret = pipe(pp);
if (ret == -1)
tst_brkm(TFAIL, cleanup, "pipe() failed, errno %d",
errno);
strcpy(wbuf, "abcd\0");
len = strlen(wbuf);
pid = fork();
if (pid < 0)
tst_brkm(TFAIL, cleanup, "fork() failed, errno %d",
errno);
if (pid == 0) {
/* CHILD */
if (signal(SIGUSR2, catch_usr2) == SIG_ERR)
tst_resm(TWARN, "signal setup for SIGUSR2 "
"failed");
if (signal(SIGPIPE, SIG_DFL) == SIG_ERR)
tst_resm(TWARN, "signal setup for SIGPIPE "
"failed");
close(pp[0]); /* close read end of pipe */
write(pp[1], wbuf, len);
while(!usrsig)
sleep(1);
write(pp[1], wbuf, len);
exit(1);
} else {
/* PARENT */
close(pp[1]); /* close write end of pipe */
rlen = read(pp[0], rbuf, len);
if (strcmp(wbuf, rbuf) != 0)
tst_resm(TFAIL, "pipe read data and pipe "
"write data didn't match");
close(pp[0]); /* close read end of pipe */
kill(pid, SIGUSR2);
wait(&status);
if (WIFSIGNALED(status))
sig = WTERMSIG(status);
if (sig != SIGPIPE)
tst_resm(TFAIL, "SIGPIPE not returned by "
"child process");
else
tst_resm(TPASS, "child process returned "
"expected SIGPIPE");
}
}
cleanup();
/* NOT REACHED */
return 0;
}
void catch_usr2(int sig) {
usrsig = 1;
}
/*
* setup() - performs all ONE TIME setup for this test.
*/
void
setup()
{
/* capture signals */
tst_sig(FORK, DEF_HANDLER, cleanup);
/* Pause if that option was specified */
TEST_PAUSE;
}
/*
* 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();
}
--- NEW FILE: pipe03.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
* pipe03.c
*
* DESCRIPTION
* Make sure that writing to the read end of a pipe and reading from
* the write end of a pipe both fail.
*
* ALGORITHM
* 1. Open a pipe
* 2. Attempt to write to the [0] descriptor (expect -1)
* 3. Attempt to read from the [1] descriptor (expect -1)
*
* USAGE: <for command-line>
* pipe03 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
* where, -c n : Run n copies concurrently.
* -f : Turn off functionality Testing.
* -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.
*
* HISTORY
* 11/2002 Ported by Paul Larson
*/
#include <unistd.h>
#include <errno.h>
#include "test.h"
#include "usctest.h"
char *TCID = "pipe03";
int TST_TOTAL = 1;
extern int Tst_count;
int exp_enos[] = {EBADF, 0};
void setup(void);
void cleanup(void);
int main(int ac, char **av)
{
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
int fildes[2]; /* fds for pipe read and write */
char rbuf[BUFSIZ];
/* parse standard options */
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);
/*NOTREACHED*/
}
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping */
Tst_count = 0;
TEST(pipe(fildes));
if (TEST_RETURN == -1)
tst_brkm(TBROK, cleanup, "pipe() failed unexpectedly "
"- errno %d", TEST_ERRNO);
TEST(write(fildes[0], "A", 1));
if (TEST_RETURN == -1 && TEST_ERRNO == EBADF)
tst_resm(TPASS, "expected failure writing to "
"read end of pipe");
else
tst_resm(TFAIL, "success when writing to read "
"end of pipe ret=%d, errno=%d",
TEST_RETURN, TEST_ERRNO);
TEST(read(fildes[1], rbuf, 1));
if (TEST_RETURN == -1 && TEST_ERRNO == EBADF)
tst_resm(TPASS, "expected failure reading from "
"write end of pipe");
else
tst_resm(TFAIL, "success when reading from "
"write end of pipe ret=%d, "
"errno=%d", TEST_RETURN,
TEST_ERRNO);
}
cleanup();
/*NOTREACHED*/
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;
}
/*
* 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();
}
--- NEW FILE: pipe04.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
* pipe04.c
*
* DESCRIPTION
* Check that processes are killable, even when they are still writing
* data to a pipe.
*
* ALGORITHM
* 1. Open a pipe
* 2. fork a two children that will write to the pipe
* 3. read a bit from both children
* 3. kill both children and wait to make sure they die
*
* USAGE: <for command-line>
* pipe04 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
* where, -c n : Run n copies concurrently.
* -f : Turn off functionality Testing.
* -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.
*
* HISTORY
* 11/2002 Ported by Paul Larson
*/
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "test.h"
#include "usctest.h"
char *TCID = "pipe04";
int TST_TOTAL = 1;
extern int Tst_count;
int exp_enos[] = {EBADF, 0};
int fildes[2]; /* fds for pipe read and write */
void setup(void);
void cleanup(void);
void c1func(void);
void c2func(void);
void alarmfunc(int);
int main(int ac, char **av)
{
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
pid_t c1pid, c2pid;
int wtchild, wtstatus;
int bytesread;
int acnt=0, bcnt=0;
char rbuf[BUFSIZ];
/* parse standard options */
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);
/*NOTREACHED*/
}
setup();
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping */
Tst_count = 0;
if (pipe(fildes) == -1)
tst_brkm(TBROK, cleanup, "pipe() failed - errno %d",
errno);
if ((c1pid = fork()) == -1)
tst_brkm(TBROK, cleanup, "fork() failed - "
"errno %d", errno);
if (c1pid == 0)
c1func();
if((c2pid = fork()) == -1)
tst_brkm(TBROK, cleanup, "fork() failed - "
"errno %d", errno);
if (c2pid == 0)
c2func();
/* PARENT */
if (close(fildes[1]) == -1)
tst_resm(TWARN, "Could not close fildes[1] - errno %d",
errno);
/*
* Read a bit from the children first
*/
while((acnt < 100) && (bcnt < 100)) {
bytesread = read(fildes[0], rbuf, sizeof(rbuf));
if (bytesread < 0) {
tst_resm(TFAIL, "Unable to read from pipe, "
"errno=%d",errno);
break;
}
switch(rbuf[1]) {
case 'A': acnt++;
break;
case 'b': bcnt++;
break;
default: tst_resm(TFAIL, "Got bogus '%c' "
"character",rbuf[1]);
break;
}
}
/*
* Try to kill the children
*/
if (kill(c1pid, SIGKILL) == -1)
tst_resm(TFAIL, "failed to kill child 1, errno=%d",
errno);
if (kill(c2pid, SIGKILL) == -1)
tst_resm(TFAIL, "failed to kill child 1, errno=%d",
errno);
/*
* Set action for the alarm
*/
if (signal(SIGALRM, alarmfunc) == SIG_ERR)
tst_resm(TWARN, "call to signal failed, errno=%d",
errno);
/*
* Set an alarm for 60 seconds just in case the child
* processes don't die
*/
alarm(60);
if((wtchild=waitpid(c1pid,&wtstatus,0)) != -1) {
if (wtstatus != SIGKILL)
tst_resm(TFAIL, "unexpected wait status %d, "
"errno=%d",wtstatus,errno);
else
tst_resm(TPASS, "Child 1 killed while "
"writing to a pipe");
}
if((wtchild=waitpid(c2pid,&wtstatus,0)) != -1) {
if (wtstatus != SIGKILL)
tst_resm(TFAIL, "unexpected wait status %d, "
"errno=%d",wtstatus,errno);
else
tst_resm(TPASS, "Child 2 killed while "
"writing to a pipe");
}
if (alarm(0) <= 0)
tst_resm(TWARN, "call to alarm(0) failed");
}
cleanup();
/*NOTREACHED*/
return 0;
}
/*
* setup() - performs all ONE TIME setup for this test.
*/
void setup()
{
/* capture signals */
tst_sig(FORK, DEF_HANDLER, cleanup);
/* Pause if that option was specified */
TEST_PAUSE;
}
/*
* 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();
}
void c1func()
{
if (close(fildes[0]) == -1)
tst_resm(TWARN, "Could not close fildes[0] - errno %d",
errno);
while(1)
if (write(fildes[1], "bbbbbbbbbbbbbbbbbbbbbbbbb", 25) == -1)
tst_resm(TBROK, "Child 1 error writing to pipe - "
"errno %d", errno);
}
void c2func()
{
if (close(fildes[0]) == -1)
tst_resm(TWARN, "Could not close fildes[0] - errno %d",
errno);
while(1)
if (write(fildes[1], "AAAAAAAAAAAAAAAAAAAAAAAAA", 25) == -1)
tst_resm(TBROK, "Child 2 error writing to pipe - "
"errno %d", errno);
}
void alarmfunc(int sig)
{
/* for some reason tst_brkm doesn't seem to work in a signal handler */
tst_resm(TFAIL, "One or more children did not die within 60 seconds");
cleanup();
}
--- NEW FILE: pipe07.c ---
/*
*
* Copyright (c) International Business Machines Corp., 2002
*
* 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
* pipe07.c
*
* DESCRIPTION
* Test the ability of pipe to open the maximum even number of file
* descriptors permitted (or (maxfds - 3)/2 pipes)
*
* ALGORITHM
* 1. open pipes until EMFILE is returned
* 2. check to see that the number of pipes opened is
* (maxfds - 3) / 2
*
* USAGE: <for command-line>
* pipe07 [-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.
*
* HISTORY
* 12/2002 Ported by Paul Larson
*
* RESTRICTIONS
* None
*/
#include <fcntl.h>
#include <errno.h>
#include "test.h"
#include "usctest.h"
char *TCID = "pipe07";
int TST_TOTAL = 1;
extern int Tst_count;
int exp_enos[] = {EMFILE, 0};
int pipe_ret, pipes[2];
void setup(void);
void cleanup(void);
int main(int ac, char **av)
{
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
int min; /* number of file descriptors */
int npipes; /* number of pipes opened */
/* parse standard options */
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);
/*NOTREACHED*/
}
setup();
TEST_EXP_ENOS(exp_enos);
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping */
Tst_count = 0;
min = getdtablesize();
/* subtract 3 for std files */
min -= 3;
for (npipes = 0; ; npipes++) {
pipe_ret = pipe(pipes);
if (pipe_ret < 0) {
if (errno != EMFILE) {
tst_brkm(TFAIL, cleanup,
"got unexpected error - %d",
errno);
}
break;
}
}
if (npipes == (min / 2))
tst_resm(TPASS, "Opened maxfds/2 pipes");
else
tst_resm(TFAIL, "Unable to open maxfds/2 pipes");
}
cleanup();
/* NOT REACHED */
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;
}
/*
* 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();
}
|
|
From: <ro...@us...> - 2003-01-06 16:25:23
|
Update of /cvsroot/ltp/ltp/testcases/misc/dlsuite In directory sc8-pr-cvs1:/tmp/cvs-serv1985/dlsuite Log Message: Directory /cvsroot/ltp/ltp/testcases/misc/dlsuite added to the repository |
|
From: <iye...@us...> - 2003-01-04 05:03:26
|
Update of /cvsroot/ltp/ltp/testcases/commands/eject
In directory sc8-pr-cvs1:/tmp/cvs-serv29925
Modified Files:
eject-tests.sh
Log Message:
Modified. Return count RC should be re-set before each test so that
failure due to a previous test does not affect the subsequent tests.
Index: eject-tests.sh
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/commands/eject/eject-tests.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- eject-tests.sh 4 Jan 2003 05:00:56 -0000 1.4
+++ eject-tests.sh 4 Jan 2003 05:03:24 -0000 1.5
@@ -107,12 +107,14 @@
TFAILCNT=$((TFAILCNT+1))
fi
+
# Test #3
# Test the eject command will eject the default cdrom device and also unmount
# device if it is currently mounted.
export TCID=eject03
export TST_COUNT=3
+RC=0
$LTPBIN/tst_resm TINFO "Test #3: eject command will eject the default cdrom"
$LTPBIN/tst_resm TINFO "Test #3: device and also unmount the device if it"
|