git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
capitests: Test guestfs_last_errno call.
[libguestfs.git]
/
generator
/
generator_capitests.ml
diff --git
a/generator/generator_capitests.ml
b/generator/generator_capitests.ml
index
594c867
..
325b37c
100644
(file)
--- a/
generator/generator_capitests.ml
+++ b/
generator/generator_capitests.ml
@@
-175,22
+175,14
@@
int main (int argc, char *argv[])
guestfs_set_error_handler (g, print_error, NULL);
guestfs_set_error_handler (g, print_error, NULL);
- guestfs_set_path (g, \"../appliance\");
-
filename = \"test1.img\";
filename = \"test1.img\";
- fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_
NONBLOCK|O_
TRUNC, 0666);
+ fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_TRUNC, 0666);
if (fd == -1) {
perror (filename);
exit (EXIT_FAILURE);
}
if (fd == -1) {
perror (filename);
exit (EXIT_FAILURE);
}
- if (lseek (fd, %d, SEEK_SET) == -1) {
- perror (\"lseek\");
- close (fd);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- if (write (fd, &c, 1) == -1) {
- perror (\"write\");
+ if (ftruncate (fd, %d) == -1) {
+ perror (\"ftruncate\");
close (fd);
unlink (filename);
exit (EXIT_FAILURE);
close (fd);
unlink (filename);
exit (EXIT_FAILURE);
@@
-206,19
+198,13
@@
int main (int argc, char *argv[])
}
filename = \"test2.img\";
}
filename = \"test2.img\";
- fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_
NONBLOCK|O_
TRUNC, 0666);
+ fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_TRUNC, 0666);
if (fd == -1) {
perror (filename);
exit (EXIT_FAILURE);
}
if (fd == -1) {
perror (filename);
exit (EXIT_FAILURE);
}
- if (lseek (fd, %d, SEEK_SET) == -1) {
- perror (\"lseek\");
- close (fd);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- if (write (fd, &c, 1) == -1) {
- perror (\"write\");
+ if (ftruncate (fd, %d) == -1) {
+ perror (\"ftruncate\");
close (fd);
unlink (filename);
exit (EXIT_FAILURE);
close (fd);
unlink (filename);
exit (EXIT_FAILURE);
@@
-234,19
+220,13
@@
int main (int argc, char *argv[])
}
filename = \"test3.img\";
}
filename = \"test3.img\";
- fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_
NONBLOCK|O_
TRUNC, 0666);
+ fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_TRUNC, 0666);
if (fd == -1) {
perror (filename);
exit (EXIT_FAILURE);
}
if (fd == -1) {
perror (filename);
exit (EXIT_FAILURE);
}
- if (lseek (fd, %d, SEEK_SET) == -1) {
- perror (\"lseek\");
- close (fd);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- if (write (fd, &c, 1) == -1) {
- perror (\"write\");
+ if (ftruncate (fd, %d) == -1) {
+ perror (\"ftruncate\");
close (fd);
unlink (filename);
exit (EXIT_FAILURE);
close (fd);
unlink (filename);
exit (EXIT_FAILURE);
@@
-720,6
+700,13
@@
and generate_test_command_call ?(expect_error = false) ?test test_name cmd =
with Not_found ->
failwithf "%s: in test, command %s was not found" test_name name in
with Not_found ->
failwithf "%s: in test, command %s was not found" test_name name in
+ (* If the call has optional args, fold them all together. We cannot
+ * test partial optional args yet.
+ *)
+ let style =
+ let ret, args, optargs = style in
+ ret, args@optargs in
+
if List.length (snd style) <> List.length args then
failwithf "%s: in test, wrong number of args given to %s"
test_name name;
if List.length (snd style) <> List.length args then
failwithf "%s: in test, wrong number of args given to %s"
test_name name;