Skip to content

Commit fd1d39f

Browse files
committed
Move tests runner to uefi-test-runner
This is in anticipation for support for running tests from the `tests` directory.
1 parent 3eb1e7a commit fd1d39f

File tree

12 files changed

+28
-18
lines changed

12 files changed

+28
-18
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ bitflags = "1"
1010

1111
[workspace]
1212
members = [
13-
"tests",
13+
"uefi-test-runner",
1414
"uefi-logger",
1515
"uefi-alloc",
1616
"uefi-services",

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,34 @@ This project contains multiple sub-crates:
2323
- `uefi-utils`: building on top of `uefi-services`, this crate provides a higher-level access to UEFI functions.
2424
Provides utility functions for common API usage.
2525

26-
- `tests`: a sample UEFI applications that runs unit tests.
26+
- `uefi-test-runner` a UEFI application that runs unit / integration tests.
27+
28+
- `examples`: example UEFI apps.
29+
30+
- `tests`: unit and integration tests.
2731

2832
## Documentation
2933

3034
This crate's documentation is fairly minimal, and you are encouraged to refer to
3135
the [UEFI specification][spec] for detailed information.
3236

33-
You can find some example code in the `tests` directory,
34-
as well as use the `build.py` script to generate the documentation.
37+
[spec]: http://www.uefi.org/specifications
3538

36-
This repo also contains a `x86_64-uefi.json` file, which is
37-
a custom Rust target for 64-bit UEFI applications.
39+
### rustdoc
3840

39-
[spec]: http://www.uefi.org/specifications
41+
Use the `build.py` script in the `uefi-test-runner` directory to generate the documentation:
42+
43+
```sh
44+
./build.py doc
45+
```
46+
47+
### Sample code
48+
49+
Some example UEFI apps are in the `examples` directory.
50+
51+
The unit / integration tests are in the `tests` directory.
52+
53+
This repo also contains a `x86_64-uefi.json` file, which is a custom Rust target for 64-bit UEFI applications.
4054

4155
## Building UEFI programs
4256

@@ -69,6 +83,7 @@ You can use the `tests` directory as sample code for building a simple UEFI app.
6983

7084
## License
7185

72-
The code in this repository is licensed under the Mozilla Public License 2. This license allows you to use the crate in proprietary programs, but any modifications to the files must be open-sourced.
86+
The code in this repository is licensed under the Mozilla Public License 2.
87+
This license allows you to use the crate in proprietary programs, but any modifications to the files must be open-sourced.
7388

7489
The full text of the license is available in the `LICENSE` file.
File renamed without changes.

tests/Cargo.toml renamed to uefi-test-runner/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "tests"
2+
name = "uefi-test-runner"
33
version = "0.1.0"
44
authors = ["Gabriel Majeri <[email protected]>"]
55
publish = false
File renamed without changes.
File renamed without changes.

tests/build.py renamed to uefi-test-runner/build.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,22 @@
2525

2626
# Path to directory containing `OVMF_{CODE/VARS}.fd`.
2727
# TODO: use installed OVMF, if available.
28-
OVMF_DIR = WORKSPACE_DIR / 'tests'
28+
OVMF_DIR = WORKSPACE_DIR / 'uefi-test-runner'
2929

3030
BUILD_DIR = WORKSPACE_DIR / 'target' / TARGET / CONFIG
3131
ESP_DIR = BUILD_DIR / 'esp'
3232

33-
# File with test output.
34-
LOG_FILE = BUILD_DIR / 'tests.log'
35-
3633
def run_xargo(verb, *flags):
3734
'Runs Xargo with certain arguments.'
3835
sp.run([XARGO, verb, '--target', TARGET, *flags]).check_returncode()
3936

4037
def build():
4138
'Builds the tests package.'
4239

43-
run_xargo('build', '--package', 'tests')
40+
run_xargo('build', '--package', 'uefi-test-runner')
4441

4542
# Copy the built file to the right directory for running tests.
46-
built_file = BUILD_DIR / 'tests.efi'
43+
built_file = BUILD_DIR / 'uefi-test-runner.efi'
4744

4845
boot_dir = ESP_DIR / 'EFI' / 'Boot'
4946
boot_dir.mkdir(parents=True, exist_ok=True)
@@ -84,8 +81,6 @@ def run_qemu():
8481
# Mount a local directory as a FAT partition.
8582
'-drive', f'if=none,format=raw,file=fat:rw:{ESP_DIR},id=esp',
8683
'-device', 'ide-drive,bus=ahci.0,drive=esp',
87-
# Enable the debug connection to allow retrieving test data from the test runner.
88-
'-debugcon', f'file:{LOG_FILE}', '-global', 'isa-debugcon.iobase=0xE9',
8984
# Only enable when debugging UEFI boot:
9085
#'-debugcon', 'file:debug.log', '-global', 'isa-debugcon.iobase=0x402',
9186
]
@@ -99,7 +94,7 @@ def main(args) -> int:
9994
os.environ['RUSTFLAGS'] = ''
10095

10196
# Temporary solution for https://github.com/rust-lang/cargo/issues/4905
102-
os.environ['RUST_TARGET_PATH'] = str(WORKSPACE_DIR / 'tests')
97+
os.environ['RUST_TARGET_PATH'] = str(WORKSPACE_DIR / 'uefi-test-runner')
10398

10499
print(os.environ['RUST_TARGET_PATH'])
105100

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)