We still have the unfortunate situation that the SNP test
depends on DHCP of the PXE test, but now it is much clearer
how the UDP packet is sent via Ethernet and how the echo
service is used.
Although the changes look big, most things were just reordered
(moved out of the loop body) and decoupled. The function finding
the proper handle verifies the interface has the right MAC, to
prevent failure and ease debugging.
UEFI Boot services includes a helper function (CalculateCrc32) for calculating a
32-bit CRC over a buffer. This is useful in Rust applications as well, so expose
it in the boot services API.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Allocating page-aligned memory via the global allocator is not
uncommon for UEFI OS loaders. Therefore, it is feasible to use a
shortcut in the allocator, and directly use boot::allocate_pages()
rather than boot::allocate_pool().
We can look at the TRACE messages of `cargo xtask run` to
verify that the shortcut is taken.
The test case does not use multicast. The edk2 virtio-net driver
does not support multicast. Drop it from packet filter.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
The edk2 virtio-net driver does not support statistics and returns
UNSUPPORTED. This is correct behavior.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
In case the network has not been started before (say by pxe test) the
shutdown and stop functions may return NOT_STARTED. This is normal
behavior and not a test failure.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Methods are now provided to access mode data instead of direct field access.
In a later PR, this will help with switching the public API to use
`core::net::IpAddr`.
Missing from the boot services is the SignalEvent() function, which is used to
place signals into a signaled state. Implement this to allow applications to
signal e.g. event groups.
Also implement a test case, checking that the event callback is signaled when
the newly introduced function is invoked.
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Split the conversion tests out into separate functions. This is a bit more
verbose, but makes it clearer exactly what is being tested.
The conversion tests now use a hardcoded test `DevicePath`, so we no longer need
to `cfg` the tests for different arches based on what devices QEMU creates. This
also makes it clearer what effects `DisplayOnly` and `AllowShortcuts` can have
on the text conversion.
The methods of both DevicePathToText and DevicePathFromText return memory that
is allocated internally by UEFI, so it needs to be freed on
drop. DevicePathToText already does that correctly by returning a `PoolString`,
but this was missed in DevicePathFromText, which just returns a reference.
Fix by adding PoolDevicePath and PoolDevicePathNode structs, and return them
from the corresponding methods of DevicePathFromText.
The signature fix itself is trivial, just adding a `&`. The test changes had
already been partially rewritten during the freestanding table function
refactor. Now alter constants and variable names, remove a use of `as`, and free
the memory at the end.
The PR originally included a cleanup commit ("uefi-test-runner: Fix buffer
alignment on ia32") that ended up being cherry-picked and merged in a separate
PR: https://github.com/rust-osdev/uefi-rs/pull/844. Rewrite that fix here as
well.
This covers these commits:
d7697c3ab59609873a1c
Prior to this commit, the `name` field of `VariableKey` was not public, so it
was not possible to construct `VariableKey` outside of this crate. This is a
problem for unit tests that want to mock `runtime::variable_keys`; there's no
way for the unit test to construct the iterator elements.
Fix by making `name` public. Also change the `name` type from a `Vec<u16>` to a
`CString16`; this makes the type easier to work with, since in all cases
variable names should be UCS-2. The `VariableKeys` iterator now yields an error
for variables with non-UCS-2 names (but such errors do not stop iteration; you
can simply continue on to the next variable key).
Also deprecate the `VariableKey::name()` method, since it just returns the same
thing as the `name` field now.