Skip to content

Commit

Permalink
tests: Fix ioctl data type
Browse files Browse the repository at this point in the history
The `0xdeadbeef` constant in Vala is implicitly an int64. On 32 bit
big-endian architectures like powerpc this argument vanishes during its
interpretation through varargs and long (i.e. gets shifted to the second
argument, which we never look at). Explicitly make it an int.
  • Loading branch information
martinpitt committed Jan 5, 2025
1 parent 4fa4c8e commit 9e68706
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test-umockdev-vala.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1140,10 +1140,11 @@ E: SUBSYSTEM=test
int fd = Posix.open ("/dev/test", Posix.O_RDWR, 0);
assert_cmpint (fd, CompareOperator.GE, 0);

assert_cmpint (Posix.ioctl (fd, 1, 0xdeadbeef), CompareOperator.EQ, (int) 0xdeadbeef);
int value = (int) 0xdeadbeef;
assert_cmpint (Posix.ioctl (fd, 1, value), CompareOperator.EQ, value);
assert_cmpint (Posix.errno, CompareOperator.EQ, 0);

assert_cmpint (Posix.ioctl (fd, 2, 0xdeadbeef), CompareOperator.EQ, -1);
assert_cmpint (Posix.ioctl (fd, 2, value), CompareOperator.EQ, -1);
assert_cmpint (Posix.errno, CompareOperator.EQ, Posix.ENOMEM);

assert_cmpint (Posix.ioctl (fd, 3, &ioctl_target), CompareOperator.EQ, 0);
Expand Down

0 comments on commit 9e68706

Please sign in to comment.