Skip to content

Commit 780522b

Browse files
committed
Merge remote-tracking branch 'benma/remove-device-tests'
2 parents 5885a5d + aa589bb commit 780522b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+0
-4170
lines changed

.ci/ci

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ make -j8 firmware-semihosting
5656

5757
make -C tools/go/src/atecc608a test
5858

59-
# Build device tests
60-
make -j8 device-tests
61-
6259
# Don't generate graphics in CI
6360
(cd build; cmake -DDOC_GRAPHS=NO ..)
6461
make -j8 docs

BUILD.md

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -186,75 +186,3 @@ make coverage # or make -C build-build coverage
186186
```sh
187187
make -C build-build coverage-lcovr
188188
```
189-
190-
### Device tests
191-
192-
If you have a developer device at hand you can run device tests on it. Device tests help to verify functionality on an actual device.
193-
Feedback can be provided via the screen or via USB. They are especially useful to test low-level, driver-specific features.
194-
195-
Device tests replace the source file where the main function resides, but otherwise have access to all firmware functions.
196-
197-
#### Code and build structure
198-
199-
The python scripts for setting up and running the test can be found under `test/device-test`. Firmware test code can be found
200-
under `test/device-test/src`. `test/device-test/src/common` contains common C code functions that many test cases might need.
201-
202-
The object and binary files are built into `test/device-test/build`.
203-
204-
#### How to set up a test
205-
206-
The `test/device-test/setup_test.py` script assists you in building the binary with a given test case, flashing the device
207-
with the resulting `device-test.bin` that gets built into `test/device-test/build/bin` and resetting the device so that the test is started.
208-
209-
You can run `setup_test.py` as follows:
210-
211-
```sh
212-
./test/device-test/setup_test.py -t test/device-test/src/startup_test.c
213-
```
214-
215-
If you run it successfully, the device should print `Integration test` on the screen.
216-
217-
#### How to write a test
218-
219-
The test becomes more interesting as we add the ability to function in a python script.
220-
Here is an example for a python test:
221-
222-
```python
223-
#!/usr/bin/env python
224-
225-
from setup_test import *
226-
import sys
227-
import time
228-
229-
# required to find py/dbb_utils.py
230-
test_dir = os.path.dirname(os.path.realpath(__file__))
231-
sys.path.insert(0, test_dir + '/../py/')
232-
233-
from dbb_utils import *
234-
235-
def main(argv):
236-
test = "src/test_usb_hww_ep_in.c"
237-
setup(argv, test)
238-
run_test(test)
239-
240-
def run_test(testfile):
241-
print("execute testcase for " + testfile)
242-
print("expecting 'Hi HWW!' as a reply")
243-
244-
try:
245-
openSpecificHid(USB_HWW)
246-
time.sleep(5)
247-
reply = hid_send_and_read_plain('Hi HWW!', 5)
248-
249-
except IOError as ex:
250-
print(ex)
251-
except(KeyboardInterrupt, SystemExit):
252-
print("Exiting code")
253-
dbb_hid.close()
254-
255-
if __name__ == "__main__":
256-
main(sys.argv[1:])
257-
```
258-
259-
The test passes the C test file to `setup()`. Afterwards it executed `run_test()`.
260-
In `run_test`, it opens the HID interface `HWW` and sends some data over USB.

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,6 @@ endif()
411411

412412
if(CMAKE_CROSSCOMPILING)
413413
add_dependencies(doc rust-docs)
414-
endif()
415-
416-
if(CMAKE_CROSSCOMPILING)
417-
add_subdirectory(test/device-test)
418414
else()
419415
include(CTest)
420416
add_subdirectory(test/unit-test)

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ rust-docs: | build
9696
$(MAKE) -C build rust-docs
9797
unit-test: | build-build
9898
$(MAKE) -C build-build
99-
device-tests: | build
100-
${MAKE} -C build device-tests
10199
# Must compile C tests before running them
102100
run-unit-tests: | build-build
103101
CTEST_OUTPUT_ON_FAILURE=1 $(MAKE) -C build-build test

src/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -544,13 +544,6 @@ foreach(type ${RUST_LIBS})
544544
# https://github.com/rust-lang/rust/issues/66740
545545
RUSTC_BOOTSTRAP=1
546546
${CARGO} build $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:-v> --features target-${type} --target-dir ${RUST_BINARY_DIR}/feature-${type} ${RUST_CARGO_FLAG} ${RUST_TARGET_ARCH_ARG}
547-
COMMAND
548-
# Rust packages stdlib functions which we must remove/weaken on the arm target
549-
# Currently the removed symbols only clash in device-tests for some reason. Without this command, compiling device tests would result in errors like:
550-
# Linking C executable ../../bin/fw_test_usb_cmd_process.elf
551-
# /usr/local/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld: /usr/local/bin/../lib/gcc/arm-none-eabi/8.2.1/thumb/v7e-m+fp/softfp/libgcc.a(_arm_addsubdf3.o): in function `__aeabi_dsub':
552-
# (.text+0x8): multiple definition of `__aeabi_dsub'; ../../lib/libfirmware_rust_c.a(compiler_builtins-5829be534503bd8e.compiler_builtins.cthmhl66-cgu.175.rcgu.o):/cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.27/src/macros.rs:226: first defined here
553-
if test "x${RUST_TARGET_ARCH}" = "xthumbv7em-none-eabi" \; then ${CMAKE_OBJCOPY} -W __aeabi_dsub -W __aeabi_dadd -W__aeabi_i2d -W __aeabi_f2d -W __aeabi_dmul -W __aeabi_ul2d ${lib} \; fi
554547
COMMAND
555548
${CMAKE_COMMAND} -E copy_if_different ${lib} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/lib${type}_rust_c.a
556549
# DEPFILES are only supported with the Ninja build tool

0 commit comments

Comments
 (0)