Added progress indicators for all tests
This commit is contained in:
parent
f6c107f839
commit
b5858e4360
@ -138,9 +138,12 @@ trymany(int num, const char *word)
|
||||
const char *args[num+2];
|
||||
int i;
|
||||
|
||||
nprintf(".");
|
||||
args[0] = _PATH_MYSELF;
|
||||
for (i=0; i<num; i++) {
|
||||
args[i+1] = word;
|
||||
if(i%10)
|
||||
nprintf(".");
|
||||
}
|
||||
args[num+1] = NULL;
|
||||
execv(_PATH_MYSELF, (char **)args);
|
||||
@ -377,6 +380,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
else if (checkmany(argc, argv, 1000, word8)) {
|
||||
#endif
|
||||
nprintf("\n");
|
||||
warnx("Complete.");
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/bigexec");
|
||||
return 0;
|
||||
|
@ -246,10 +246,12 @@ main(int argc, char *argv[])
|
||||
}
|
||||
else if (argc == 3) {
|
||||
if (!strcmp(argv[1], "1") || !strcmp(argv[1], "0")) {
|
||||
nprintf("\n");
|
||||
tprintf("%s\n", argv[2]);
|
||||
secprintf(SECRET, argv[2], "/testbin/factorial");
|
||||
}
|
||||
else {
|
||||
nprintf(".");
|
||||
number_init(&n1, argv[1]);
|
||||
number_init(&n2, argv[2]);
|
||||
number_init(&multbuf, "0");
|
||||
|
@ -95,6 +95,7 @@ check(void)
|
||||
mypid = getpid();
|
||||
|
||||
/* Make sure each fork has its own address space. */
|
||||
nprintf(".");
|
||||
for (i=0; i<800; i++) {
|
||||
volatile int seenpid;
|
||||
seenpid = mypid;
|
||||
@ -181,15 +182,19 @@ test(int nowait)
|
||||
}
|
||||
|
||||
pid0 = dofork();
|
||||
nprintf(".");
|
||||
write(fd, "A", 1);
|
||||
check();
|
||||
pid1 = dofork();
|
||||
nprintf(".");
|
||||
write(fd, "B", 1);
|
||||
check();
|
||||
pid2 = dofork();
|
||||
nprintf(".");
|
||||
write(fd, "C", 1);
|
||||
check();
|
||||
pid3 = dofork();
|
||||
nprintf(".");
|
||||
write(fd, "D", 1);
|
||||
check();
|
||||
|
||||
@ -198,9 +203,13 @@ test(int nowait)
|
||||
* improperly.
|
||||
*/
|
||||
dowait(nowait, pid3);
|
||||
nprintf(".");
|
||||
dowait(nowait, pid2);
|
||||
nprintf(".");
|
||||
dowait(nowait, pid1);
|
||||
nprintf(".");
|
||||
dowait(nowait, pid0);
|
||||
nprintf(".");
|
||||
|
||||
// Check if file contents are correct
|
||||
// lseek may not be implemented..so close and reopen
|
||||
@ -209,6 +218,8 @@ test(int nowait)
|
||||
if(fd < 3) {
|
||||
err(1, "Failed to open file for verification\n");
|
||||
}
|
||||
nprintf(".");
|
||||
|
||||
char buffer[30];
|
||||
int len;
|
||||
int char_idx, i;
|
||||
@ -221,9 +232,11 @@ test(int nowait)
|
||||
if(len != 30) {
|
||||
err(1, "Did not get expected number of characters\n");
|
||||
}
|
||||
nprintf(".");
|
||||
// Check if number of instances of each character is correct
|
||||
// 2As; 4Bs; 8Cs; 16Ds
|
||||
for(char_idx = 0; char_idx < 4; char_idx++) {
|
||||
nprintf(".");
|
||||
observed = 0;
|
||||
expected = pow_int(2, char_idx + 1);
|
||||
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);
|
||||
}
|
||||
}
|
||||
nprintf("\n");
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/forktest");
|
||||
close(fd);
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ main(int argc, char **argv)
|
||||
if(fd < 0) {
|
||||
err(1, "Failed to open file.\n");
|
||||
}
|
||||
nprintf(".");
|
||||
|
||||
len = write(fd, MAGIC, expected_len);
|
||||
if(len != expected_len) {
|
||||
@ -79,6 +80,7 @@ main(int argc, char **argv)
|
||||
if(fd < 0) {
|
||||
err(1, "Failed to open file.\n");
|
||||
}
|
||||
nprintf(".");
|
||||
|
||||
char buf[32];
|
||||
len = read(fd, buf, expected_len);
|
||||
@ -87,12 +89,15 @@ main(int argc, char **argv)
|
||||
" Only read %d bytes.\n",
|
||||
expected_len, len);
|
||||
}
|
||||
nprintf(".");
|
||||
|
||||
if(strcmp(MAGIC, buf) != 0) {
|
||||
err(1, "Did not match MAGIC string.\n"
|
||||
"MAGIC: %s\n"
|
||||
"GOT : %s\n", MAGIC, buf);
|
||||
}
|
||||
nprintf(".");
|
||||
nprintf("\n");
|
||||
|
||||
secprintf(SECRET, MAGIC, "/testbin/readwritetest");
|
||||
// Exit may not be implemented. So crash.
|
||||
|
@ -195,14 +195,20 @@ main(void)
|
||||
{
|
||||
tprintf("Creating %s...\n", INFILE);
|
||||
mkfile();
|
||||
nprintf(".");
|
||||
|
||||
tprintf("Running cat < %s > %s\n", INFILE, OUTFILE);
|
||||
cat();
|
||||
nprintf(".");
|
||||
|
||||
tprintf("Checking %s...\n", OUTFILE);
|
||||
chkfile();
|
||||
nprintf(".");
|
||||
|
||||
tprintf("Passed.\n");
|
||||
nprintf(".");
|
||||
nprintf("\n");
|
||||
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/redirect");
|
||||
(void)remove(INFILE);
|
||||
(void)remove(OUTFILE);
|
||||
|
@ -66,6 +66,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
tprintf("Creating a sparse file of size %d\n", size);
|
||||
nprintf(".");
|
||||
|
||||
fd = open(filename, O_RDWR|O_CREAT|O_TRUNC);
|
||||
if (fd < 0) {
|
||||
@ -75,10 +76,12 @@ main(int argc, char *argv[])
|
||||
if (lseek(fd, size-1, SEEK_SET) == -1) {
|
||||
err(1, "%s: lseek", filename);
|
||||
}
|
||||
nprintf(".");
|
||||
r = write(fd, &byte, 1);
|
||||
if (r < 0) {
|
||||
err(1, "%s: write", filename);
|
||||
}
|
||||
nprintf(".");
|
||||
else if (r != 1) {
|
||||
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) {
|
||||
err(1, "lseek failed to seek to beginning of file\n");
|
||||
}
|
||||
nprintf(".");
|
||||
// Now seek back to where the byte should be
|
||||
// While at it, also test SEEK_CUR
|
||||
if(lseek(fd, size-1, SEEK_CUR) == -1) {
|
||||
err(1, "lseek failed to seek to %d of file\n", size-1);
|
||||
}
|
||||
nprintf(".");
|
||||
char test;
|
||||
r = read(fd, &test, 1);
|
||||
if(test != byte) {
|
||||
err(1, "Byte test failed. Expected (%c) != Observed (%c)\n", byte, test);
|
||||
}
|
||||
nprintf(".");
|
||||
close(fd);
|
||||
|
||||
nprintf("\n");
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/sparsefile");
|
||||
// Exit may not be implemented. So crash.
|
||||
crash_prog();
|
||||
|
Loading…
x
Reference in New Issue
Block a user