1) Moved tprintf and related functions to their own file in common/libc/printf/tprintf.c.

This file is included by both libc and hostcompat.

2) Changed printf -> tprintf in all testbin programs
This commit is contained in:
Scott Haseley
2016-01-15 13:33:11 -05:00
parent 98ff530afb
commit 0ab862abfa
49 changed files with 501 additions and 478 deletions

View File

@@ -182,7 +182,7 @@ static
void
try_seeking(int fd, off_t pos, off_t cursize)
{
printf("Seeking to (and near) 0x%llx\n", pos);
tprintf("Seeking to (and near) 0x%llx\n", pos);
/* Go to the place. */
dolseek(fd, pos, SEEK_SET, "SEEK_SET", pos);
@@ -215,30 +215,30 @@ main(void)
off_t cursize;
int fd;
printf("Creating file...\n");
tprintf("Creating file...\n");
fd = open(TESTFILE, O_RDWR|O_CREAT|O_TRUNC, 0664);
if (fd < 0) {
err(1, "%s", TESTFILE);
}
printf("Writing something at offset 0\n");
tprintf("Writing something at offset 0\n");
write_slogan(fd, 0, false);
cursize = strlen(slogans[0]);
try_seeking(fd, (off_t)0x1000LL, cursize);
printf("Writing something else\n");
tprintf("Writing something else\n");
write_slogan(fd, 1, false);
cursize = (off_t)0x1000LL + strlen(slogans[1]);
try_seeking(fd, (off_t)0, cursize);
/* If seek is totally bust, this will fail. */
printf("Checking what we wrote\n");
tprintf("Checking what we wrote\n");
check_slogan(fd, 0);
try_seeking(fd, (off_t)0x1000LL, cursize);
printf("Checking the other thing we wrote\n");
tprintf("Checking the other thing we wrote\n");
check_slogan(fd, 1);
try_seeking(fd, (off_t)0x20LL, cursize);
@@ -250,19 +250,19 @@ main(void)
try_seeking(fd, (off_t)0x180000000LL, cursize);
try_seeking(fd, (off_t)0x180000020LL, cursize);
printf("Now trying to read (should get EOF)\n");
tprintf("Now trying to read (should get EOF)\n");
try_reading(fd);
printf("Now trying to write (should get EFBIG)\n");
tprintf("Now trying to write (should get EFBIG)\n");
try_writing(fd);
try_seeking(fd, (off_t)0x100000000LL, cursize);
/* If seek truncates to 32 bits, this might read the slogan instead */
printf("Trying to read again (should get EOF)\n");
tprintf("Trying to read again (should get EOF)\n");
try_reading(fd);
printf("Passed.\n");
tprintf("Passed.\n");
close(fd);
remove(TESTFILE);