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: <ro...@us...> - 2002-12-31 21:20:54
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/abort
In directory sc8-pr-cvs1:/tmp/cvs-serv21958
Modified Files:
abort01.c
Log Message:
Added code to use the tst_tmpdir()/tst_rmdir() APIs
Index: abort01.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/abort/abort01.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- abort01.c 30 Dec 2002 19:47:41 -0000 1.1
+++ abort01.c 31 Dec 2002 21:20:50 -0000 1.2
@@ -148,6 +148,7 @@
/* Clean up any files created by test before call to anyfail. */
unlink("core");
+ tst_rmdir();
anyfail(); /* THIS CALL DOES NOT RETURN - EXITS!! */
return(0);
}
@@ -167,6 +168,7 @@
void setup()
{
temp = stderr;
+ tst_tmpdir();
}
int blenter()
|
|
From: <ro...@us...> - 2002-12-31 20:54:18
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/fmtmsg In directory sc8-pr-cvs1:/tmp/cvs-serv4488 Modified Files: fmtmsg01.c Log Message: Corrected copyright info. Index: fmtmsg01.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/fmtmsg/fmtmsg01.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- fmtmsg01.c 30 Dec 2002 21:32:41 -0000 1.1 +++ fmtmsg01.c 31 Dec 2002 20:54:14 -0000 1.2 @@ -1,30 +1,24 @@ -/* IBM Corporation */ -/* 01/02/2003 Port to LTP av...@us... */ -/* 06/30/2001 Port to Linux nsh...@us... */ - /* - * $Copyright: $ - * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994 - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * Copyright (c) International Business Machines Corp., 2002 * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. + * 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. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - + * 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 */ + +/* 01/02/2003 Port to LTP av...@us... */ +/* 06/30/2001 Port to Linux nsh...@us... */ /* * NAME |
|
From: <ro...@us...> - 2002-12-31 20:46:54
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/kill In directory sc8-pr-cvs1:/tmp/cvs-serv31793 Removed Files: Makefile.bak Log Message: Removed this old backup. --- Makefile.bak DELETED --- |
|
From: <pl...@us...> - 2002-12-31 16:00:23
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/gethostid
In directory sc8-pr-cvs1:/tmp/cvs-serv28761
Modified Files:
gethostid01.c
Log Message:
Added functional test to gethostid01 to compare result from gethostid() versus the hostid command
Index: gethostid01.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/gethostid/gethostid01.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- gethostid01.c 27 Aug 2001 22:15:13 -0000 1.1
+++ gethostid01.c 31 Dec 2002 16:00:18 -0000 1.2
@@ -103,6 +103,10 @@
*
* Cleanup:
* Print errno log and/or timing stats if options given
+ *
+ * History:
+ * 12/2002 Paul Larson - Added functional test to compare
+ * output from hostid command and gethostid()
*
*
*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
@@ -114,11 +118,11 @@
#include "test.h"
#include "usctest.h"
+#define HOSTIDLEN 40
+
extern void setup();
extern void cleanup();
-
-
char *TCID="gethostid01"; /* Test program identifier. */
int TST_TOTAL=1; /* Total number of test cases. */
extern int Tst_count; /* Test Case counter for tst_* routines */
@@ -130,8 +134,8 @@
{
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
-
- ;
+ char name[HOSTIDLEN], hostid[HOSTIDLEN];
+ FILE *fp;
/***************************************************************
* parse standard options
@@ -155,13 +159,6 @@
/* reset Tst_count in case we are looping. */
Tst_count=0;
-
- /*
- * TEST CASE:
- * Get host name
- */
- ;
-
/* Call gethostid(2) */
TEST(gethostid( ));
@@ -172,13 +169,31 @@
TEST_ERRNO, strerror(TEST_ERRNO));
continue; /* next loop for MTKERNEL */
}
+ sprintf(hostid, "%x", TEST_RETURN);
/***************************************************************
* only perform functional verification if flag set (-f not given)
***************************************************************/
if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "gethostid - Get host name returned %d", TEST_RETURN);
+ if (system("hostid > hostid.x") == -1)
+ tst_brkm(TFAIL, cleanup, "system() returned errno %d",
+ errno);
+ if ((fp=fopen("hostid.x", "r")) == NULL)
+ tst_brkm(TFAIL, cleanup, "fopen failed");
+ if (fgets(name, HOSTIDLEN, fp) == NULL)
+ tst_brkm(TFAIL, cleanup, "fgets failed");
+ fclose(fp);
+
+ /* strip off the \n we got from reading the file */
+ name[strlen(name)-1] = 0;
+
+ if (strcmp(name, hostid) == 0) {
+ tst_resm(TPASS, "Hostid command and gethostid both report hostid "
+ "is %s", hostid);
+ } else
+ tst_resm(TFAIL, "Hostid command reports hostid is %s, "
+ "but gethostid() reports %s",
+ name, hostid);
}
} /* End for TEST_LOOPING */
@@ -197,10 +212,12 @@
setup()
{
/* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
+ tst_sig(FORK, DEF_HANDLER, cleanup);
/* Pause if that option was specified */
TEST_PAUSE;
+
+ tst_tmpdir();
} /* End setup() */
@@ -216,6 +233,8 @@
* print errno log if that option was specified.
*/
TEST_CLEANUP;
+
+ tst_rmdir();
/* exit with return code appropriate for results */
tst_exit();
|
|
From: <ro...@us...> - 2002-12-30 21:34:30
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/creat
In directory sc8-pr-cvs1:/tmp/cvs-serv19958
Added Files:
creat08.c
Log Message:
Added creat08 ported by Airong Zhang <zh...@us...>
--- NEW FILE: creat08.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
* creat08.c - Verifies that the group ID and setgid bit are
* set correctly when a new file is created.
* (ported from SPIE, section2/iosuite/creat5.c,
* by Airong Zhang <zh...@us...>)
* CALLS
* creat
*
* 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
* creat08
*
* 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 "test.h"
#include "usctest.h"
char *TCID = "creat08";
int TST_TOTAL = 1;
extern int Tst_count;
int local_flag;
#define PASSED 1
#define FAILED 0
#define MODE_RWX S_IRWXU | S_IRWXG | S_IRWXO
#define MODE_SGID S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO
#define DIR_A_TEMP "testdir.A.%d"
#define DIR_B_TEMP "testdir.B.%d"
#define SETGID "setgid"
#define NOSETGID "nosetgid"
#define ROOT_SETGID "root_setgid"
#define MSGSIZE 150
extern int errno;
int issu();
/*--------------------------------------------------------------*/
int 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];
int fail_count = 0;
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 */
/*
* 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, "Must be root to run this test.\n");
tst_exit();
}
if ( (ret = system("/usr/sbin/useradd user1 -p user1")) == -1) {
tst_resm(TBROK, "add user1 failed\n");
tst_exit();
}
if ( (ret = system("/usr/sbin/groupadd group1")) == -1) {
tst_resm(TBROK, "add group1 failed\n");
tst_exit();
}
if ( (ret = system("/usr/sbin/groupadd group2")) == -1) {
tst_resm(TBROK, "add group2 failed\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("user1")) == NULL) {
tst_resm(TBROK, "user1 not in /etc/passwd\n");
tst_exit();
}
user1_uid = user1->pw_uid;
/*
* Get the group IDs of group1 and group2.
*/
if ((group = getgrnam("group1")) == NULL) {
tst_resm(TINFO, "group1 not in /etc/group\n");
}
group1_gid = group->gr_gid;
if ((group = getgrnam("group2")) == NULL) {
tst_resm(TINFO, "group2 not in /etc/group\n");
}
group2_gid = group->gr_gid;
/*--------------------------------------------------------------*/
/* Block0: Set up the parent directories */
/*--------------------------------------------------------------*/
/*
* 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 of %s failed", DIR_A);
local_flag = FAILED;
}
if ((ret = chown(DIR_A, user1_uid, group2_gid)) < 0) {
tst_resm(TFAIL, "Chown of %s failed", DIR_A);
local_flag = FAILED;
}
if ((ret = stat(DIR_A, &buf)) < 0) {
tst_resm(TFAIL, "Stat of %s failed", 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. */
/*--------------------------------------------------------------*/
/*
* Now become user1, group1
*/
if ((ret = setgid(group1_gid)) < 0) {
tst_resm(TINFO,"Unable to set process group ID to group1");
}
if ((ret = setreuid(-1, user1_uid)) < 0) {
tst_resm(TINFO, "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);
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 */
/* directory, group2. */
/*--------------------------------------------------------------*/
/*
* Create the file with setgid not set
*/
if ((ret = creat(nosetgid_B, 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 not 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);
local_flag = FAILED;
}
/*
* Create the file with setgid set
*/
if ((ret = creat(setgid_B, 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(TFAIL,"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 should be 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. */
/*--------------------------------------------------------------*/
/* Become root again */
if ((ret = setreuid(-1, save_myuid)) < 0) {
tst_resm(errno, 0, "Changing back to root failed");
local_flag = FAILED;
}
/* Create the file with setgid set */
if ((ret = creat(root_setgid_B, 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(TBROK, "Warning: %s not removed", setgid_A);
}
if ((ret = unlink(nosetgid_A)) < 0) {
tst_resm(TBROK, "Warning: %s not removed", nosetgid_A);
}
if ((ret = rmdir(DIR_A)) < 0) {
tst_resm(TBROK, "Warning: %s not removed", DIR_A);
}
if ((ret = unlink(setgid_B)) < 0) {
tst_resm(TBROK, "Warning: %s not removed", setgid_B);
}
if ((ret = unlink(root_setgid_B)) < 0) {
tst_resm(TBROK, "Warning: %s not removed", root_setgid_B);
}
if ((ret = unlink(nosetgid_B)) < 0) {
tst_resm(TBROK, "Warning: %s not removed", nosetgid_B);
}
if ((ret = rmdir(DIR_B)) < 0) {
tst_resm(TBROK, "Warning: %s not removed", DIR_B);
}
if (fail_count == 0 ) {
tst_resm(TPASS, "Test passed.\n");
} else {
tst_resm(TFAIL, "Test failed because of above failures.\n");
}
/*system("userdel,user1");
*system("groupdel,group1");
*system("groupdel,group2");
*/
} /* end for */
return(0);
}
int issu() {
int uid;
uid = (-1);
uid = geteuid();
if (uid == (-1)) {
tst_resm(TINFO,"geteuid: failed in issu()");
return(-1);
}
if ( uid == 0) {
return(0);
} else {
tst_resm(TINFO,"*** NOT SUPERUSER must be root %s\n",TCID);
return(uid);
}
return(0);
}
|
|
From: <ro...@us...> - 2002-12-30 21:32:47
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/fmtmsg
In directory sc8-pr-cvs1:/tmp/cvs-serv19204/testcases/kernel/syscalls/fmtmsg
Added Files:
Makefile fmtmsg01.c
Log Message:
Added fmtmsg() test ported by Ananda Venkataraman <av...@us...>
--- 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: fmtmsg01.c ---
/* IBM Corporation */
/* 01/02/2003 Port to LTP av...@us... */
/* 06/30/2001 Port to Linux nsh...@us... */
/*
* $Copyright: $
* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
*/
/*
* NAME
* fmtmsg -- test fmtmsg(3C) and addseverity(3C)
*
* CALLS
* fmtmsg(3), addseverity(3C)
*
* ALGORITHM
* Check basic functionality using various messages and severity levels.
*
* RESTRICTIONS
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include <stdio.h>
#include <fmtmsg.h> /* interface definition */
#include <string.h>
/***** LTP Port *****/
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include "test.h"
#include "usctest.h"
#define FAILED 0
#define PASSED 1
char *TCID = "fmtms01";
int local_flag = PASSED;
int block_number;
FILE *temp;
int TST_TOTAL = 1;
extern int Tst_count;
int anyfail();
int blenter();
int blexit();
void setup();
/***** ** ** *****/
//char progname[]= "fmtmsg1()";
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";
clearbuf()
{
int i;
for (i=0; i<80; i++)
buf[i] = (char)NULL;
}
/*--------------------------------------------------------------*/
main(int argc, char *argv[])
{
int fd, ret_val;
FILE *fp;
setup(); /* temp file is now open */
/*--------------------------------------------------------------*/
block0: 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");
close(fd);
if (ret_val != 0) {
fprintf(temp, "fmtmsg returned %d, expected 0\n\n", ret_val);
local_flag = FAILED;
}
fp = fopen("fmtfile", "r");
clearbuf();
fread(buf, sizeof(buf[0]), strlen(str1), fp);
if (strcmp(str1, buf) != 0) {
fprintf(temp, "Expected string: %s\n", str1);
fprintf(temp, "does not match\n");
fprintf(temp, "received string: %s\n\n", buf);
local_flag = FAILED;
}
/* Read past spaces in output */
fread(&ch, sizeof(ch), 1, fp);
while(isspace(ch))
fread(&ch, sizeof(ch), 1, fp);
ungetc(ch, fp);
clearbuf();
fread(buf, sizeof(buf[0]), strlen(str2), fp);
fclose(fp);
if (strcmp(str2, buf) != 0) {
fprintf(temp, "Expected string: %s\n", str2);
fprintf(temp, "does not match\n");
fprintf(temp, "received string: %s\n\n", buf);
local_flag = FAILED;
}
blexit();
/*--------------------------------------------------------------*/
block1: blenter();
/* Check that a system defined SEV_LEVEL cannot get redefined */
ret_val = addseverity(3, "INVALID");
if (ret_val != MM_NOTOK) {
fprintf(temp, "addseverity returned %d, expected MM_NOTOK\n",
ret_val);
local_flag = FAILED;
}
blexit();
/*--------------------------------------------------------------*/
block2: blenter();
/* Check that we can define our own */
/* SEV_LEVEL and output is correct */
ret_val = addseverity(5, "SPIE_TEST");
if (ret_val != MM_OK) {
fprintf(temp, "addseverity returned %d, expected MM_OK\n",
ret_val);
local_flag = FAILED;
}
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");
close(fd);
if (ret_val != 0) {
fprintf(temp, "fmtmsg returned %d, expected 0\n",ret_val);
local_flag = FAILED;
}
fp = fopen("fmtfile", "r");
clearbuf();
fread(buf, sizeof(buf[0]), strlen(str3), fp);
if (strcmp(str3, buf) != 0) {
fprintf(temp, "Expected string: %s\n", str3);
fprintf(temp, "does not match\n");
fprintf(temp, "received string: %s\n\n", buf);
local_flag = FAILED;
}
/* Read past spaces in output */
fread(&ch, sizeof(ch), 1, fp);
while(isspace(ch))
fread(&ch, sizeof(ch), 1, fp);
ungetc(ch, fp);
clearbuf();
fread(buf, sizeof(buf[0]), strlen(str4), fp);
if (strcmp(str4, buf) != 0) {
fprintf(temp, "Expected string: %s\n", str4);
fprintf(temp, "does not match\n");
fprintf(temp, "received string: %s\n\n", buf);
local_flag = FAILED;
}
fclose(fp);
remove("fmtfile");
blexit();
/*--------------------------------------------------------------*/
block3: 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");
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");
local_flag = FAILED;
}
blexit();
/*--------------------------------------------------------------*/
/* Clean up any files created by test before call to anyfail. */
anyfail(); /* THIS CALL DOES NOT RETURN - EXITS!! */
}
/*--------------------------------------------------------------*/
/***** LTP Port *****/
/* FUNCTIONS GO HERE */
int anyfail()
{
(local_flag == FAILED)? tst_resm(TFAIL, "Test failed\n"): tst_resm(TPASS, "Test passed\n");
tst_rmdir();
tst_exit();
}
void setup()
{
temp = stderr;
tst_tmpdir();
}
int blenter()
{
//tst_resm(TINFO, "Enter block %d\n", block_number);
local_flag = PASSED;
return(0);
}
int blexit()
{
//tst_resm(TINFO, "Exitng test\n");
(local_flag == FAILED) ? tst_resm(TFAIL, "Test failed\n") : tst_resm(TPASS, "Test passed\n");
return(0);
}
/***** ** ** *****/
|
|
From: <ro...@us...> - 2002-12-30 21:32:46
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls In directory sc8-pr-cvs1:/tmp/cvs-serv19204/testcases/kernel/syscalls Modified Files: Makefile Log Message: Added fmtmsg() test ported by Ananda Venkataraman <av...@us...> Index: Makefile =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/Makefile,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Makefile 30 Dec 2002 19:47:40 -0000 1.37 --- Makefile 30 Dec 2002 21:32:40 -0000 1.38 *************** *** 34,38 **** creat create_module delete_module dup dup2 execl \ execle execlp execv execve execvp exit fchdir fchmod \ ! fchown fcntl fdatasync flock fork fpathconf fstat fstatfs \ fsync ftruncate getcwd getdents getdomainname getegid geteuid \ getgid getgroups gethostid gethostname getitimer getpeername \ --- 34,38 ---- creat create_module delete_module dup dup2 execl \ execle execlp execv execve execvp exit fchdir fchmod \ ! fchown fcntl fdatasync flock fmtmsg fork fpathconf fstat fstatfs \ fsync ftruncate getcwd getdents getdomainname getegid geteuid \ getgid getgroups gethostid gethostname getitimer getpeername \ |
|
From: <ro...@us...> - 2002-12-30 21:32:46
|
Update of /cvsroot/ltp/ltp/runtest In directory sc8-pr-cvs1:/tmp/cvs-serv19204/runtest Modified Files: syscalls Log Message: Added fmtmsg() test ported by Ananda Venkataraman <av...@us...> Index: syscalls =================================================================== RCS file: /cvsroot/ltp/ltp/runtest/syscalls,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** syscalls 30 Dec 2002 20:58:28 -0000 1.88 --- syscalls 30 Dec 2002 21:32:36 -0000 1.89 *************** *** 169,172 **** --- 169,174 ---- flock05 flock05 + fmtmsg01 fmtmsg01 + fork01 fork01 fork02 fork02 |
|
From: <ro...@us...> - 2002-12-30 21:22:18
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/fmtmsg In directory sc8-pr-cvs1:/tmp/cvs-serv14586/fmtmsg Log Message: Directory /cvsroot/ltp/ltp/testcases/kernel/syscalls/fmtmsg added to the repository |
|
From: <ro...@us...> - 2002-12-30 20:58:32
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/dup
In directory sc8-pr-cvs1:/tmp/cvs-serv2893/testcases/kernel/syscalls/dup
Modified Files:
Makefile
Added Files:
dup06.c dup07.c
Log Message:
Added ported dup06 and dup07 tests from Airong Zhang <zh...@us...>
--- NEW FILE: dup06.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
*/
/* Pored from SPIE, section2/iosuite/dup1.c, by Airong Zhang */
/*======================================================================
=================== TESTPLAN SEGMENT ===================
>KEYS: < dup()
>WHAT: < Does dup return -1 on the 21st file?
>HOW: < Create up to _NFILE (20) files and check for -1 return on the
< next attempt
< Should check NOFILE as well as _NFILE. 19-Jun-84 Dale.
>BUGS: <
======================================================================*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include "test.h"
#include "usctest.h"
char *TCID = "dup06";
int TST_TOTAL = 1;
extern int Tst_count;
int local_flag;
#define PASSED 1
#define FAILED 0
/*--------------------------------------------------------------------*/
int main(ac, av)
int ac;
char *av[];
{
int *fildes, j ;
int ifile ;
char pfilname[40] ;
int min;
char *strcpy();
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*/
}
/* pick up the nofiles */
min = getdtablesize();
fildes = (int *)malloc((min+5) * sizeof(int));
local_flag = PASSED;
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* Initialize fildes[_NFILE+5] - mailbug # 40805 */
for (j=0; j < min+5; j++)
fildes[j] = 0;
sprintf(pfilname, "dup06.%d\n", getpid());
unlink(pfilname) ;
if( (fildes[0] = creat( pfilname, 0666 )) == -1 ) {
tst_resm(TFAIL, "Cannot open first file\n" );
local_flag = FAILED ;
} else {
for( ifile = fildes[0] + 1 ; ifile < min+5 ; ifile++ ) {
if( (fildes[ifile] = dup( fildes[ifile-1] )) == -1 ) {
break ;
}
} /* end for */
if( ifile < min ) {
tst_resm(TFAIL, "Not enough files duped");
local_flag = FAILED ;
} else if ( ifile > min ) {
tst_resm(TFAIL, "Too many files duped");
local_flag = FAILED ;
}
}
/*----- ---------------------------------------------------------------*/
unlink(pfilname) ;
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed.\n");
} else {
tst_resm(TFAIL, "Test failed.\n");
}
} /* end for */
tst_exit();
return(0);
}
--- NEW FILE: dup07.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
*/
/* Pored from SPIE, section2/iosuite/dup3.c, by Airong Zhang */
/*dup3.c*/
/*======================================================================
=================== TESTPLAN SEGMENT ===================
>KEYS: < dup()
>WHAT: < Is the access mode the same for both file descriptors?
< 0: read only?
< 1: write only?
< 2: read/write?
>HOW: < Creat a file with each access mode; dup each file descriptor;
< stat each file descriptor and compare mode of each pair
>BUGS: <
======================================================================*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "test.h"
#include "usctest.h"
char *TCID = "dup07";
int TST_TOTAL = 1;
extern int Tst_count;
int local_flag;
#define PASSED 1
#define FAILED 0
char testfile[40]= "";
/*--------------------------------------------------------------------*/
int main(int ac, char **av)
{
struct stat retbuf ;
struct stat dupbuf ;
int rdoret , wroret, rdwret;
int duprdo , dupwro, duprdwr ;
/*--------------------------------------------------------------------*/
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;
for (lc = 0; TEST_LOOPING(lc); lc++) {
sprintf(testfile, "dup07.%d", getpid());
if( (rdoret = creat(testfile, 0444 )) == -1 ) {
tst_resm(TFAIL, "Unable to creat file '%s'\n", testfile) ;
local_flag = FAILED ;
} else {
if( (duprdo = dup( rdoret )) == -1 ) {
tst_resm(TFAIL, "Unable to dup '%s'\n", testfile ) ;
local_flag = FAILED ;
} else {
fstat( rdoret, &retbuf ) ;
fstat( duprdo, &dupbuf ) ;
if( retbuf.st_mode != dupbuf.st_mode )
{
tst_resm(TFAIL, "rdonly and dup do not match\n" ) ;
local_flag = FAILED ;
}
}
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in read mode.\n");
} else {
tst_resm(TFAIL, "Test failed in read mode.\n");
}
/*--------------------------------------------------------------------*/
unlink(testfile);
if( (wroret = creat( testfile, 0222 )) == -1 ) {
tst_resm(TFAIL, "Unable to creat file '%s'\n", testfile ) ;
local_flag = FAILED ;
} else {
if( (dupwro = dup( wroret )) == -1 ) {
tst_resm(TFAIL, "Unable to dup '%s'\n", testfile ) ;
local_flag = FAILED ;
} else {
fstat( wroret, &retbuf ) ;
fstat( dupwro, &dupbuf ) ;
if( retbuf.st_mode != dupbuf.st_mode ) {
tst_resm(TFAIL, "wronly and dup do not match\n" ) ;
local_flag = FAILED ;
}
}
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in write mode.\n");
} else {
tst_resm(TFAIL, "Test failed in write mode.\n");
}
/*--------------------------------------------------------------------*/
unlink(testfile);
if( (rdwret = creat(testfile, 0666 )) == -1 ) {
tst_resm(TFAIL, "Unable to creat file '%s'\n", testfile ) ;
local_flag = FAILED ;
} else {
if( (duprdwr = dup( rdwret )) == -1 ) {
tst_resm(TFAIL, "Unable to dup '%s'\n", testfile ) ;
local_flag = FAILED ;
} else {
fstat( rdwret, &retbuf ) ;
fstat( duprdwr, &dupbuf ) ;
if( retbuf.st_mode != dupbuf.st_mode ) {
tst_resm(TFAIL, "rdwr and dup do not match\n" ) ;
local_flag = FAILED ;
}
}
}
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in read/write mode.\n");
} else {
tst_resm(TFAIL, "Test failed in read/write mode.\n");
}
/*--------------------------------------------------------------------*/
unlink(testfile);
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed\n");
} else {
tst_resm(TFAIL, "Test failed\n");
}
tst_exit();
} /* end for */
return(0);
}
Index: Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/dup/Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Makefile 7 Feb 2002 01:32:02 -0000 1.3
--- Makefile 30 Dec 2002 20:58:29 -0000 1.4
***************
*** 21,25 ****
# description : make(1) description file for the send(2) tests. #
###########################################################################
! CFLAGS+= -I../../../../include
LOADLIBES+= -L../../../../lib -lltp
--- 21,25 ----
# description : make(1) description file for the send(2) tests. #
###########################################################################
! CFLAGS+= -I../../../../include -Wall -g
LOADLIBES+= -L../../../../lib -lltp
|
|
From: <ro...@us...> - 2002-12-30 20:58:32
|
Update of /cvsroot/ltp/ltp/runtest In directory sc8-pr-cvs1:/tmp/cvs-serv2893/runtest Modified Files: syscalls Log Message: Added ported dup06 and dup07 tests from Airong Zhang <zh...@us...> Index: syscalls =================================================================== RCS file: /cvsroot/ltp/ltp/runtest/syscalls,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** syscalls 30 Dec 2002 20:21:52 -0000 1.87 --- syscalls 30 Dec 2002 20:58:28 -0000 1.88 *************** *** 100,103 **** --- 100,105 ---- dup204 dup204 dup205 dup205 + dup206 dup206 + dup207 dup207 execl01 execl01 |
|
From: <ro...@us...> - 2002-12-30 20:21:55
|
Update of /cvsroot/ltp/ltp/runtest In directory sc8-pr-cvs1:/tmp/cvs-serv12298 Modified Files: syscalls Log Message: Added dup205 test. Index: syscalls =================================================================== RCS file: /cvsroot/ltp/ltp/runtest/syscalls,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** syscalls 30 Dec 2002 20:09:58 -0000 1.86 --- syscalls 30 Dec 2002 20:21:52 -0000 1.87 *************** *** 99,102 **** --- 99,103 ---- dup203 dup203 dup204 dup204 + dup205 dup205 execl01 execl01 |
|
From: <ro...@us...> - 2002-12-30 20:21:08
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/dup2
In directory sc8-pr-cvs1:/tmp/cvs-serv11854
Modified Files:
Makefile dup202.c
Added Files:
dup205.c
Log Message:
Added ported test from Airong Zhang <zh...@us...> and cleaned up some other files.
--- NEW FILE: dup205.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/dup6.c, by Airong Zhang */
/*======================================================================
=================== TESTPLAN SEGMENT ===================
>KEYS: < dup2()
>WHAT: < Does dup return -1 on the 21st file?
>HOW: < Create up to _NFILE files and check for -1 return on the
< next attempt
< Should check NOFILE as well as _NFILE. 19-Jun-84 Dale.
>BUGS: <
======================================================================*/
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "test.h"
#include "usctest.h"
char *TCID = "dup205";
int TST_TOTAL = 1;
extern int Tst_count;
int local_flag;
#define PASSED 1
#define FAILED 0
/*--------------------------------------------------------------------*/
int main(ac, av)
int ac;
char *av[];
{
int *fildes ;
int ifile ;
char pfilname[40] ;
int min;
char *strcpy();
int serrno;
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;
for (lc = 0; TEST_LOOPING(lc); lc++) {
min = getdtablesize(); /* get number of files allowed open */
fildes = (int*) malloc( (min+10)*sizeof(int) );
if( fildes == (int*) 0 ) {
tst_resm(TBROK,"malloc error\n");
tst_exit();
}
sprintf(pfilname, "./dup205.%d\n", getpid());
unlink(pfilname) ;
serrno = 0;
if( (fildes[0] = creat( pfilname, 0666 )) == -1 ) {
tst_resm(TBROK, "Cannot open first file\n" );
tst_exit();
} else {
fildes[fildes[0]] = fildes[0];
for( ifile = fildes[0] + 1 ; ifile < min + 10 ; ifile++ ) {
if( (fildes[ifile] = dup2( fildes[ifile-1], ifile )) == -1 ) {
serrno = errno;
break ;
} else {
if (fildes[ifile] != ifile) {
tst_resm(TFAIL,"got wrong descriptor number back: %d != %d",fildes[ifile], ifile);
tst_exit();
}
}
} /* end for */
if( ifile < min ) {
tst_resm(TFAIL, "Not enough files duped");
local_flag = FAILED ;
} else if ( ifile > min ) {
tst_resm(TFAIL, "Too many files duped");
local_flag = FAILED ;
}
if ((serrno != EBADF) && (serrno != EMFILE) && (serrno != EINVAL) ) {
tst_resm(TFAIL, "bad errno on dup2 failure");
local_flag = FAILED ;
}
}
/*--------------------------------------------------------------------*/
unlink(pfilname) ;
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed.\n");
} else {
tst_resm(TFAIL, "Test failed.\n");
}
} /* end for */
tst_exit();
return(0);
}
Index: Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/dup2/Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Makefile 7 Feb 2002 01:32:02 -0000 1.3
--- Makefile 30 Dec 2002 20:21:04 -0000 1.4
***************
*** 21,25 ****
# description : make(1) description file for the send(2) tests. #
###########################################################################
! CFLAGS+= -I../../../../include
LOADLIBES+= -L../../../../lib -lltp
--- 21,25 ----
# description : make(1) description file for the send(2) tests. #
###########################################################################
! CFLAGS+= -I../../../../include -Wall -g
LOADLIBES+= -L../../../../lib -lltp
Index: dup202.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/dup2/dup202.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dup202.c 27 Aug 2001 22:15:13 -0000 1.1
--- dup202.c 30 Dec 2002 20:21:05 -0000 1.2
***************
*** 54,57 ****
--- 54,58 ----
#include <usctest.h>
#include <errno.h>
+ #include <fcntl.h>
char *TCID = "dup202";
|
|
From: <ro...@us...> - 2002-12-30 20:10:03
|
Update of /cvsroot/ltp/ltp/runtest In directory sc8-pr-cvs1:/tmp/cvs-serv8272 Modified Files: syscalls Log Message: Added creat08 test. Index: syscalls =================================================================== RCS file: /cvsroot/ltp/ltp/runtest/syscalls,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** syscalls 30 Dec 2002 19:54:31 -0000 1.85 --- syscalls 30 Dec 2002 20:09:58 -0000 1.86 *************** *** 79,82 **** --- 79,83 ---- creat06 creat06 creat07 creat07 -F $LTPROOT/testcases/bin/test1 + creat08 creat08 creat09 creat09 |
|
From: <ro...@us...> - 2002-12-30 20:08:53
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/creat In directory sc8-pr-cvs1:/tmp/cvs-serv7897 Modified Files: Makefile Log Message: Added ported test by Airong Zhang <zh...@us...> Index: Makefile =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/creat/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 7 Feb 2002 01:32:02 -0000 1.3 --- Makefile 30 Dec 2002 20:08:47 -0000 1.4 *************** *** 21,25 **** # description : make(1) description file for the send(2) tests. # ########################################################################### ! CFLAGS+= -I../../../../include LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite --- 21,25 ---- # description : make(1) description file for the send(2) tests. # ########################################################################### ! CFLAGS+= -I../../../../include -Wall -g LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite |
|
From: <ro...@us...> - 2002-12-30 19:54:34
|
Update of /cvsroot/ltp/ltp/runtest In directory sc8-pr-cvs1:/tmp/cvs-serv2853 Modified Files: syscalls Log Message: Added abort() test. Index: syscalls =================================================================== RCS file: /cvsroot/ltp/ltp/runtest/syscalls,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** syscalls 30 Dec 2002 18:08:19 -0000 1.84 --- syscalls 30 Dec 2002 19:54:31 -0000 1.85 *************** *** 1,2 **** --- 1,4 ---- + abort01 ulimit -c 1024;abort01;ulimit -c 0 + accept01 accept01 |
|
From: <ro...@us...> - 2002-12-30 19:47:43
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls In directory sc8-pr-cvs1:/tmp/cvs-serv32493 Modified Files: Makefile Log Message: Added abort() test ported by Ananda Venkataraman <av...@us...> Index: Makefile =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/Makefile,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Makefile 30 Dec 2002 18:07:13 -0000 1.36 --- Makefile 30 Dec 2002 19:47:40 -0000 1.37 *************** *** 30,34 **** SUBDIR= \ ! accept access acct adjtimex alarm asyncio bind brk capget\ chdir chmod chown chroot clone close connect confstr \ creat create_module delete_module dup dup2 execl \ --- 30,34 ---- SUBDIR= \ ! abort accept access acct adjtimex alarm asyncio bind brk capget\ chdir chmod chown chroot clone close connect confstr \ creat create_module delete_module dup dup2 execl \ |
|
From: <ro...@us...> - 2002-12-30 19:47:43
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/abort
In directory sc8-pr-cvs1:/tmp/cvs-serv32493/abort
Added Files:
Makefile abort01.c
Log Message:
Added abort() test ported by Ananda Venkataraman <av...@us...>
--- 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 #
###########################################################################
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: abort01.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
*/
/* 01/02/2003 Port to LTP av...@us... */
/* 06/30/2001 Port to Linux nsh...@us... */
/*
* NAME
* abort
*
* CALLS
* abort(3)
*
* ALGORITHM
* Fork child. Have child abort, check return status.
*
* RESTRICTIONS
* The ulimit for core file size must be greater than 0.
*
* CHANGE LOG:
* Nov 11 2002: Ported to LTP Suite by Ananda
*
*/
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
/***** LTP Port *****/
#include "test.h"
#include "usctest.h"
#define ITER 3
#define FAILED 0
#define PASSED 1
//char progname[]= "abort1()";
char *TCID = "abort01";
int local_flag = PASSED;
int block_number;
FILE *temp;
int TST_TOTAL = 1;
extern int Tst_count;
int anyfail();
int blenter();
int blexit();
int instress();
void setup();
void terror();
void fail_exit();
void ok_exit();
int forkfail();
/***** ** ** *****/
/*--------------------------------------------------------------*/
int main (int argc, char *argv[])
{
register int i;
int status, count, child, kidpid;
int core, sig, ex;
setup(); /* temp file is now open */
/*--------------------------------------------------------------*/
blenter();
for (i=0; i < ITER; i++) {
if ((kidpid = fork()) == 0) {
abort();
fprintf(temp, "\tchild - abort failed.\n");
exit(0);
}
if (kidpid < 0) {
terror("Fork failed (may be OK if under stress)");
if (instress())
ok_exit();
forkfail();
}
count = 0;
while ((child = wait(&status)) > 0) {
count++;
}
if (count != 1) {
fprintf(temp, "\twrong # children waited on.\n");
fprintf(temp, "\tgot %d, expected %d\n", count, 1);
fail_exit();
}
/*
sig = status & 0177;
core = status & 0200;
ex = (status & 0xFF00) >> 8;
*/
/***** LTP Port *****/
sig = WTERMSIG(status);
#ifdef WCOREDUMP
core = WCOREDUMP(status);
#endif
ex = WIFEXITED(status);
/***** ** ** *****/
if (!core) {
fprintf(temp, "\tChild did not return core bit set!\n");
fprintf(temp, "\t iteration %d, exit stat = 0x%x\n",
i, status);
fprintf(temp, "\tCore = %d, sig = %d, ex = %d\n",
core, sig, ex);
local_flag = FAILED;
}
if (sig != SIGIOT) {
fprintf(temp, "\tChild did not exit with SIGIOT (%d)\n",
SIGIOT);
fprintf(temp, "\t iteration %d, exit stat = 0x%x\n",
i, status);
fprintf(temp, "\tCore = %d, sig = %d, ex = %d\n",
core, sig, ex);
local_flag = FAILED;
}
if (local_flag == FAILED)
break;
}
blexit();
/*--------------------------------------------------------------*/
/* Clean up any files created by test before call to anyfail. */
unlink("core");
anyfail(); /* THIS CALL DOES NOT RETURN - EXITS!! */
return(0);
}
/*--------------------------------------------------------------*/
/****** LTP Port *****/
int anyfail()
{
tst_resm(TINFO, "Exiting test\n");
(local_flag == FAILED)? tst_resm(TFAIL, "Test failed\n"): tst_resm(TPASS, "Test passed\n");
tst_exit();
return(0);
}
void setup()
{
temp = stderr;
}
int blenter()
{
local_flag = PASSED;
return(0);
}
int blexit()
{
(local_flag == FAILED) ? tst_resm(TFAIL, "Test failed\n") : tst_resm(TPASS, "Test passed\n");
tst_exit();
return(0);
}
int instress()
{
tst_resm(TINFO, "System resources may be too low; fork(), select() etc are likely to fail.\n");
return(1);
}
void terror(char * message)
{
tst_resm(TBROK, "Reason: %s:%s\n", message, strerror(errno));
}
void fail_exit()
{
local_flag = FAILED;
anyfail();
}
void ok_exit()
{
local_flag = PASSED;
tst_resm(TINFO, "Test passed\n");
}
int forkfail()
{
fprintf(temp, "\t\tFORK FAILED - terminating test.\n");
tst_exit();
return(0);
}
/****** ** ** *******/
|
|
From: <ro...@us...> - 2002-12-30 19:32:35
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/abort In directory sc8-pr-cvs1:/tmp/cvs-serv27073/abort Log Message: Directory /cvsroot/ltp/ltp/testcases/kernel/syscalls/abort added to the repository |
|
From: <ro...@us...> - 2002-12-30 18:08:22
|
Update of /cvsroot/ltp/ltp/runtest In directory sc8-pr-cvs1:/tmp/cvs-serv32340 Modified Files: syscalls Log Message: Added iopl() tests. Index: syscalls =================================================================== RCS file: /cvsroot/ltp/ltp/runtest/syscalls,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** syscalls 27 Dec 2002 18:47:45 -0000 1.83 --- syscalls 30 Dec 2002 18:08:19 -0000 1.84 *************** *** 270,273 **** --- 270,276 ---- ioctl02 ioctl02 -D /dev/ttyS0 + iopl01 iopl01 + iopl02 iopl02 + kill01 kill01 kill02 kill02 |
|
From: <ro...@us...> - 2002-12-30 18:07:17
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/iopl
In directory sc8-pr-cvs1:/tmp/cvs-serv31395/iopl
Added Files:
Makefile iopl01.c iopl02.c
Log Message:
Added iopl() tests by Subhab Biswas <sub...@wi...>
--- 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 #
###########################################################################
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: iopl01.c ---
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
*/
/**********************************************************
*
* TEST IDENTIFIER : iopl01
*
* EXECUTED BY : superuser
*
* TEST TITLE : Basic test for iopl(2)
*
* TEST CASE TOTAL : 4
*
* AUTHOR : Subhab Biswas <sub...@wi...>
*
* SIGNALS
* Uses SIGUSR1 to pause before test if option set.
* (See the parse_opts(3) man page).
*
* DESCRIPTION
* This is a Phase I test for the iopl(2) system call.
* It is intended to provide a limited exposure of the system call.
*
* Setup:
* Setup signal handling.
* Test caller is superuser
* Pause for SIGUSR1 if option specified.
*
* Test:
* Loop if the proper options are given.
* Execute system call
* Check return code, if system call failed (return=-1)
* Issue FAIL message with errno.
* Otherwise, Issue PASS message.
*
* Cleanup:
* Print errno log and/or timing stats if options given
*
* USAGE: <for command-line>
* iopl01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
* where, -c n : Run n copies concurrently.
* -e : Turn on errno logging.
* -h : Show help screen
* -f : Turn off functional testing
* -i n : Execute test n times.
* -I x : Execute test for x seconds.
* -p : Pause for SIGUSR1 before starting
* -P x : Pause for x seconds between iterations.
* -t : Turn on syscall timing.
*
****************************************************************/
#include <errno.h>
#include <unistd.h>
#include <sys/io.h>
#include "test.h"
#include "usctest.h"
static void setup();
static void cleanup();
char *TCID = "iopl01"; /* Test program identifier. */
int TST_TOTAL = 4; /* Total number of test cases. */
extern int Tst_count; /* Test Case counter for tst_* routines */
int level; /* I/O privilege level of the process */
int
main(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_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);
}
/* perform global setup for test */
setup();
/* check looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping. */
Tst_count = 0;
/*
* Test the system call for possible privelege levels.
* As the privelge level for a normal process is 0,
* start by setting/changing the level to 0.
*/
for (level = 0; level < TST_TOTAL; ++level) {
TEST(iopl(level));
if (TEST_RETURN == -1) {
tst_resm(TFAIL, "iopl() failed for level %d, "
"errno=%d : %s", level,
TEST_ERRNO, strerror(TEST_ERRNO));
} else {
tst_resm(TPASS, "iopl() passed for level %d, "
"returned %d", level,
TEST_RETURN);
}
}
} /* End for TEST_LOOPING */
/* cleanup and exit */
cleanup();
/*NOTREACHED*/
return 0;
} /* End main */
/* setup() - performs all ONE TIME setup for this test */
void
setup()
{
/* capture signals */
tst_sig(NOFORK, DEF_HANDLER, cleanup);
/* Check whether we are root */
if (geteuid() != 0) {
tst_brkm(TBROK, tst_exit, "Must be root for this test!");
/*NOTREACHED*/
}
/* Pause if that option was specified */
TEST_PAUSE;
} /* End setup() */
/*
*cleanup() - performs all ONE TIME cleanup for this test at
* completion or premature exit.
*/
void
cleanup()
{
/*
* back to I/O privilege for normal process.
*/
if (iopl(0) == -1) {
tst_resm(TWARN, "iopl() cleanup failed");
}
/*
* print timing stats if that option was specified.
* print errno log if that option was specified.
*/
TEST_CLEANUP;
/* exit with return code appropriate for results */
tst_exit();
} /* End cleanup() */
--- NEW FILE: iopl02.c ---
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
*/
/**********************************************************
*
* TEST IDENTIFIER : iopl02
*
* EXECUTED BY : superuser
*
* TEST TITLE : Tests for error conditions
*
* TEST CASE TOTAL : 2
*
* AUTHOR : Subhab Biwas <sub...@wi...>
*
* SIGNALS
* Uses SIGUSR1 to pause before test if option set.
* (See the parse_opts(3) man page).
*
* DESCRIPTION
* Verify that
* 1) iopl(2) returns -1 and sets errno to EINVAL for privilege
* level greater than 3.
* 2) iopl(2) returns -1 and sets errno to EPERM if the current
* user is not the super-user.
*
* Setup:
* Setup signal handling.
* Test caller is superuser
* Set expected errnos for logging
* Pause for SIGUSR1 if option specified.
*
* Test:
* Loop if the proper options are given.
* Execute system call
* Check return code and error number, if matching,
* Issue PASS message
* Otherwise,
* Issue FAIL message
* Perform testcase specific cleanup (if needed)
*
* Cleanup:
* Print errno log and/or timing stats if options given
*
* USAGE: <for command-line>
* iopl02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
* where, -c n : Run n copies concurrently.
* -e : Turn on errno logging.
* -h : Show help screen
* -f : Turn off functional testing
* -i n : Execute test n times.
* -I x : Execute test for x seconds.
* -p : Pause for SIGUSR1 before starting
* -P x : Pause for x seconds between iterations.
* -t : Turn on syscall timing.
*
****************************************************************/
#include <errno.h>
#include <unistd.h>
#include <sys/io.h>
#include <pwd.h>
#include "test.h"
#include "usctest.h"
#define INVALID_LEVEL 4 /* Invalid privilege level */
#define EXP_RET_VAL -1
static void setup();
static int setup1(void);
static void cleanup1();
static void cleanup();
char *TCID = "iopl02"; /* Test program identifier. */
extern int Tst_count; /* Test Case counter for tst_* routines */
static int exp_enos[] = {EINVAL, EPERM, 0};
static char nobody_uid[] = "nobody";
struct passwd *ltpuser;
struct test_cases_t {
int level; /* I/O privilege level */
char *desc; /* test case description */
int exp_errno; /* expected error number */
} test_cases[] = {
{ INVALID_LEVEL, "Invalid privilege level", EINVAL },
{ 1, "Non super-user", EPERM }
};
int TST_TOTAL = sizeof(test_cases) / sizeof(test_cases[0]);
int
main(int ac, char **av)
{
int lc, i; /* 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_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);
}
/* perform global setup for test */
setup();
/* check looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping. */
Tst_count = 0;
for (i = 0; i < TST_TOTAL; ++i) {
if (i == 1) {
/* setup Non super-user for second test */
if (setup1()) {
/* setup1() failed, skip this test */
continue;
}
}
/*
* Call iopl(2)
*/
TEST(iopl(test_cases[i].level));
if ((TEST_RETURN == EXP_RET_VAL) &&
(TEST_ERRNO == test_cases[i].exp_errno)) {
tst_resm(TPASS, "Expected failure for %s, "
"errno: %d", test_cases[i].desc,
TEST_ERRNO);
} else {
tst_resm(TFAIL, "Unexpected results for %s ; "
"returned %d (expected %d), errno %d "
"(expected errno %d)",
test_cases[i].desc,
TEST_RETURN, EXP_RET_VAL,
TEST_ERRNO, test_cases[i].exp_errno);
}
TEST_ERROR_LOG(TEST_ERRNO);
if (i == 1) {
/* revert back to super user */
cleanup1();
}
}
} /* End for TEST_LOOPING */
/* cleanup and exit */
cleanup();
/*NOTREACHED*/
return 0;
} /* End main */
/* setup1() - set up non-super user for second test case */
int
setup1(void)
{
/* switch to "nobody" user */
if (seteuid(ltpuser->pw_uid) == -1) {
tst_resm(TWARN, "Failed to set effective"
"uid to %d", ltpuser->pw_uid);
return 1;
}
return 0;
}
/* cleanup1() - reset to super user for first test case */
void
cleanup1()
{
/* reset user as root */
if (seteuid(0) == -1) {
tst_brkm(TBROK, tst_exit, "Failed to set uid as root");
}
}
/* setup() - performs all ONE TIME setup for this test */
void
setup()
{
/* capture signals */
tst_sig(NOFORK, DEF_HANDLER, cleanup);
/* Check whether we are root */
if (geteuid() != 0) {
tst_brkm(TBROK, tst_exit, "Must be root for this test!");
}
/* Check if "nobody" user id exists */
if ((ltpuser = getpwnam(nobody_uid)) == NULL) {
tst_brkm(TBROK, tst_exit, "\"nobody\" user id doesn't exist");
}
/* Set up the expected error numbers for -e option */
TEST_EXP_ENOS(exp_enos);
/* Pause if that option was specified */
TEST_PAUSE;
} /* End setup() */
/*
*cleanup() - performs all ONE TIME cleanup for this test at
* completion or premature exit.
*/
void
cleanup()
{
/*
* print timing stats if that option was specified.
* print errno log if that option was specified.
*/
TEST_CLEANUP;
/* exit with return code appropriate for results */
tst_exit();
} /* End cleanup() */
|
|
From: <ro...@us...> - 2002-12-30 18:07:17
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls In directory sc8-pr-cvs1:/tmp/cvs-serv31395 Modified Files: Makefile Log Message: Added iopl() tests by Subhab Biswas <sub...@wi...> Index: Makefile =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/Makefile,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Makefile 27 Dec 2002 18:46:55 -0000 1.35 --- Makefile 30 Dec 2002 18:07:13 -0000 1.36 *************** *** 39,43 **** getpgid getpgrp getpid getppid getpriority getresgid getresuid \ getrusage getsid getsockname getsockopt gettimeofday getuid \ ! ioctl ipc kill lchown link \ listen llseek lseek lstat \ mkdir mknod mlock mlockall mmap modify_ldt mount mprotect \ --- 39,43 ---- getpgid getpgrp getpid getppid getpriority getresgid getresuid \ getrusage getsid getsockname getsockopt gettimeofday getuid \ ! ioctl iopl ipc kill lchown link \ listen llseek lseek lstat \ mkdir mknod mlock mlockall mmap modify_ldt mount mprotect \ |
|
From: <ro...@us...> - 2002-12-30 18:04:30
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/iopl In directory sc8-pr-cvs1:/tmp/cvs-serv28499/iopl Log Message: Directory /cvsroot/ltp/ltp/testcases/kernel/syscalls/iopl added to the repository |