Added progress indicators for all tests

This commit is contained in:
Guru Prasad Srinivasa 2016-03-01 15:19:37 -05:00
parent f6c107f839
commit b5858e4360
6 changed files with 38 additions and 0 deletions

View File

@ -138,9 +138,12 @@ trymany(int num, const char *word)
const char *args[num+2]; const char *args[num+2];
int i; int i;
nprintf(".");
args[0] = _PATH_MYSELF; args[0] = _PATH_MYSELF;
for (i=0; i<num; i++) { for (i=0; i<num; i++) {
args[i+1] = word; args[i+1] = word;
if(i%10)
nprintf(".");
} }
args[num+1] = NULL; args[num+1] = NULL;
execv(_PATH_MYSELF, (char **)args); execv(_PATH_MYSELF, (char **)args);
@ -377,6 +380,7 @@ main(int argc, char *argv[])
} }
else if (checkmany(argc, argv, 1000, word8)) { else if (checkmany(argc, argv, 1000, word8)) {
#endif #endif
nprintf("\n");
warnx("Complete."); warnx("Complete.");
success(TEST161_SUCCESS, SECRET, "/testbin/bigexec"); success(TEST161_SUCCESS, SECRET, "/testbin/bigexec");
return 0; return 0;

View File

@ -246,10 +246,12 @@ main(int argc, char *argv[])
} }
else if (argc == 3) { else if (argc == 3) {
if (!strcmp(argv[1], "1") || !strcmp(argv[1], "0")) { if (!strcmp(argv[1], "1") || !strcmp(argv[1], "0")) {
nprintf("\n");
tprintf("%s\n", argv[2]); tprintf("%s\n", argv[2]);
secprintf(SECRET, argv[2], "/testbin/factorial"); secprintf(SECRET, argv[2], "/testbin/factorial");
} }
else { else {
nprintf(".");
number_init(&n1, argv[1]); number_init(&n1, argv[1]);
number_init(&n2, argv[2]); number_init(&n2, argv[2]);
number_init(&multbuf, "0"); number_init(&multbuf, "0");

View File

@ -95,6 +95,7 @@ check(void)
mypid = getpid(); mypid = getpid();
/* Make sure each fork has its own address space. */ /* Make sure each fork has its own address space. */
nprintf(".");
for (i=0; i<800; i++) { for (i=0; i<800; i++) {
volatile int seenpid; volatile int seenpid;
seenpid = mypid; seenpid = mypid;
@ -181,15 +182,19 @@ test(int nowait)
} }
pid0 = dofork(); pid0 = dofork();
nprintf(".");
write(fd, "A", 1); write(fd, "A", 1);
check(); check();
pid1 = dofork(); pid1 = dofork();
nprintf(".");
write(fd, "B", 1); write(fd, "B", 1);
check(); check();
pid2 = dofork(); pid2 = dofork();
nprintf(".");
write(fd, "C", 1); write(fd, "C", 1);
check(); check();
pid3 = dofork(); pid3 = dofork();
nprintf(".");
write(fd, "D", 1); write(fd, "D", 1);
check(); check();
@ -198,9 +203,13 @@ test(int nowait)
* improperly. * improperly.
*/ */
dowait(nowait, pid3); dowait(nowait, pid3);
nprintf(".");
dowait(nowait, pid2); dowait(nowait, pid2);
nprintf(".");
dowait(nowait, pid1); dowait(nowait, pid1);
nprintf(".");
dowait(nowait, pid0); dowait(nowait, pid0);
nprintf(".");
// Check if file contents are correct // Check if file contents are correct
// lseek may not be implemented..so close and reopen // lseek may not be implemented..so close and reopen
@ -209,6 +218,8 @@ test(int nowait)
if(fd < 3) { if(fd < 3) {
err(1, "Failed to open file for verification\n"); err(1, "Failed to open file for verification\n");
} }
nprintf(".");
char buffer[30]; char buffer[30];
int len; int len;
int char_idx, i; int char_idx, i;
@ -221,9 +232,11 @@ test(int nowait)
if(len != 30) { if(len != 30) {
err(1, "Did not get expected number of characters\n"); err(1, "Did not get expected number of characters\n");
} }
nprintf(".");
// Check if number of instances of each character is correct // Check if number of instances of each character is correct
// 2As; 4Bs; 8Cs; 16Ds // 2As; 4Bs; 8Cs; 16Ds
for(char_idx = 0; char_idx < 4; char_idx++) { for(char_idx = 0; char_idx < 4; char_idx++) {
nprintf(".");
observed = 0; observed = 0;
expected = pow_int(2, char_idx + 1); expected = pow_int(2, char_idx + 1);
for(i = 0; i < 30; i++) { for(i = 0; i < 30; i++) {
@ -238,6 +251,7 @@ test(int nowait)
err(1, "Failed! Expected %d%cs..observed: %d\n", expected, character + char_idx, observed); err(1, "Failed! Expected %d%cs..observed: %d\n", expected, character + char_idx, observed);
} }
} }
nprintf("\n");
success(TEST161_SUCCESS, SECRET, "/testbin/forktest"); success(TEST161_SUCCESS, SECRET, "/testbin/forktest");
close(fd); close(fd);
} }

View File

@ -64,6 +64,7 @@ main(int argc, char **argv)
if(fd < 0) { if(fd < 0) {
err(1, "Failed to open file.\n"); err(1, "Failed to open file.\n");
} }
nprintf(".");
len = write(fd, MAGIC, expected_len); len = write(fd, MAGIC, expected_len);
if(len != expected_len) { if(len != expected_len) {
@ -79,6 +80,7 @@ main(int argc, char **argv)
if(fd < 0) { if(fd < 0) {
err(1, "Failed to open file.\n"); err(1, "Failed to open file.\n");
} }
nprintf(".");
char buf[32]; char buf[32];
len = read(fd, buf, expected_len); len = read(fd, buf, expected_len);
@ -87,12 +89,15 @@ main(int argc, char **argv)
" Only read %d bytes.\n", " Only read %d bytes.\n",
expected_len, len); expected_len, len);
} }
nprintf(".");
if(strcmp(MAGIC, buf) != 0) { if(strcmp(MAGIC, buf) != 0) {
err(1, "Did not match MAGIC string.\n" err(1, "Did not match MAGIC string.\n"
"MAGIC: %s\n" "MAGIC: %s\n"
"GOT : %s\n", MAGIC, buf); "GOT : %s\n", MAGIC, buf);
} }
nprintf(".");
nprintf("\n");
secprintf(SECRET, MAGIC, "/testbin/readwritetest"); secprintf(SECRET, MAGIC, "/testbin/readwritetest");
// Exit may not be implemented. So crash. // Exit may not be implemented. So crash.

View File

@ -195,14 +195,20 @@ main(void)
{ {
tprintf("Creating %s...\n", INFILE); tprintf("Creating %s...\n", INFILE);
mkfile(); mkfile();
nprintf(".");
tprintf("Running cat < %s > %s\n", INFILE, OUTFILE); tprintf("Running cat < %s > %s\n", INFILE, OUTFILE);
cat(); cat();
nprintf(".");
tprintf("Checking %s...\n", OUTFILE); tprintf("Checking %s...\n", OUTFILE);
chkfile(); chkfile();
nprintf(".");
tprintf("Passed.\n"); tprintf("Passed.\n");
nprintf(".");
nprintf("\n");
success(TEST161_SUCCESS, SECRET, "/testbin/redirect"); success(TEST161_SUCCESS, SECRET, "/testbin/redirect");
(void)remove(INFILE); (void)remove(INFILE);
(void)remove(OUTFILE); (void)remove(OUTFILE);

View File

@ -66,6 +66,7 @@ main(int argc, char *argv[])
} }
tprintf("Creating a sparse file of size %d\n", size); tprintf("Creating a sparse file of size %d\n", size);
nprintf(".");
fd = open(filename, O_RDWR|O_CREAT|O_TRUNC); fd = open(filename, O_RDWR|O_CREAT|O_TRUNC);
if (fd < 0) { if (fd < 0) {
@ -75,10 +76,12 @@ main(int argc, char *argv[])
if (lseek(fd, size-1, SEEK_SET) == -1) { if (lseek(fd, size-1, SEEK_SET) == -1) {
err(1, "%s: lseek", filename); err(1, "%s: lseek", filename);
} }
nprintf(".");
r = write(fd, &byte, 1); r = write(fd, &byte, 1);
if (r < 0) { if (r < 0) {
err(1, "%s: write", filename); err(1, "%s: write", filename);
} }
nprintf(".");
else if (r != 1) { else if (r != 1) {
errx(1, "%s: write: Unexpected result count %d", filename, r); errx(1, "%s: write: Unexpected result count %d", filename, r);
} }
@ -89,18 +92,22 @@ main(int argc, char *argv[])
if(lseek(fd, 0, SEEK_SET) == -1) { if(lseek(fd, 0, SEEK_SET) == -1) {
err(1, "lseek failed to seek to beginning of file\n"); err(1, "lseek failed to seek to beginning of file\n");
} }
nprintf(".");
// Now seek back to where the byte should be // Now seek back to where the byte should be
// While at it, also test SEEK_CUR // While at it, also test SEEK_CUR
if(lseek(fd, size-1, SEEK_CUR) == -1) { if(lseek(fd, size-1, SEEK_CUR) == -1) {
err(1, "lseek failed to seek to %d of file\n", size-1); err(1, "lseek failed to seek to %d of file\n", size-1);
} }
nprintf(".");
char test; char test;
r = read(fd, &test, 1); r = read(fd, &test, 1);
if(test != byte) { if(test != byte) {
err(1, "Byte test failed. Expected (%c) != Observed (%c)\n", byte, test); err(1, "Byte test failed. Expected (%c) != Observed (%c)\n", byte, test);
} }
nprintf(".");
close(fd); close(fd);
nprintf("\n");
success(TEST161_SUCCESS, SECRET, "/testbin/sparsefile"); success(TEST161_SUCCESS, SECRET, "/testbin/sparsefile");
// Exit may not be implemented. So crash. // Exit may not be implemented. So crash.
crash_prog(); crash_prog();