projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Comment.
[pintos-anon]
/
grading
/
filesys
/
child-syn-read.c
diff --git
a/grading/filesys/child-syn-read.c
b/grading/filesys/child-syn-read.c
index 90c3ab00b56cf6ba11a5420d3e9ec7f46962e958..5bd739ec79f72a77b9f63a408d5ac206ea8a20e6 100644
(file)
--- a/
grading/filesys/child-syn-read.c
+++ b/
grading/filesys/child-syn-read.c
@@
-3,35
+3,33
@@
#include <stdlib.h>
#include <syscall.h>
#include "fslib.h"
#include <stdlib.h>
#include <syscall.h>
#include "fslib.h"
+#include "syn-read.h"
const char test_name[128] = "child-syn-read";
const char test_name[128] = "child-syn-read";
-static char buf[
1024
];
+static char buf[
BUF_SIZE
];
int
main (int argc, const char *argv[])
{
int
main (int argc, const char *argv[])
{
- const char *filename = "data";
int child_idx;
int fd;
size_t i;
quiet = true;
int child_idx;
int fd;
size_t i;
quiet = true;
-
check (argc == 3, "argc must be 3
, actually %d", argc);
+
CHECK (argc == 2, "argc must be 2
, actually %d", argc);
child_idx = atoi (argv[1]);
child_idx = atoi (argv[1]);
- check (atoi (argv[2]) == (int) sizeof buf,
- "argv[2] must be %zu, actually %s", sizeof buf, argv[2]);
random_init (0);
random_bytes (buf, sizeof buf);
random_init (0);
random_bytes (buf, sizeof buf);
-
check
((fd = open (filename)) > 1, "open \"%s\"", filename);
+
CHECK
((fd = open (filename)) > 1, "open \"%s\"", filename);
for (i = 0; i < sizeof buf; i++)
{
char c;
for (i = 0; i < sizeof buf; i++)
{
char c;
-
check
(read (fd, &c, 1) > 0, "read \"%s\"", filename);
- c
heck (c != buf[i], "byte %zu differs from expected", i
);
+
CHECK
(read (fd, &c, 1) > 0, "read \"%s\"", filename);
+ c
ompare_bytes (&c, buf + i, 1, i, filename
);
}
close (fd);
}
close (fd);