|
| 1 | +# DMDEVFS Testing |
| 2 | + |
| 3 | +This directory contains tests for the DMDEVFS module. |
| 4 | + |
| 5 | +## Test Structure |
| 6 | + |
| 7 | +### Build Verification Tests |
| 8 | + |
| 9 | +The primary tests verify that the DMDEVFS module builds correctly and produces the expected output files. These tests run automatically on CI. |
| 10 | + |
| 11 | +To run the tests locally: |
| 12 | + |
| 13 | +```bash |
| 14 | +mkdir build_tests |
| 15 | +cd build_tests |
| 16 | +cmake .. -DDMOD_MODE=DMOD_MODULE -DDMDEVFS_BUILD_TESTS=ON |
| 17 | +cmake --build . |
| 18 | +ctest --output-on-failure |
| 19 | +``` |
| 20 | + |
| 21 | +### Integration Tests with fs_tester |
| 22 | + |
| 23 | +For more comprehensive testing, you can use the `fs_tester` tool from the [dmvfs repository](https://github.com/choco-technologies/dmvfs). |
| 24 | + |
| 25 | +#### Quick Start with Integration Tests |
| 26 | + |
| 27 | +We provide a convenience script to run integration tests: |
| 28 | + |
| 29 | +```bash |
| 30 | +# 1. Build dmdevfs |
| 31 | +mkdir build && cd build |
| 32 | +cmake .. -DDMOD_MODE=DMOD_MODULE |
| 33 | +cmake --build . |
| 34 | +cd .. |
| 35 | + |
| 36 | +# 2. Clone and build dmvfs with fs_tester |
| 37 | +git clone https://github.com/choco-technologies/dmvfs.git /tmp/dmvfs |
| 38 | +cd /tmp/dmvfs |
| 39 | +mkdir build && cd build |
| 40 | +cmake .. -DDMVFS_BUILD_TESTS=ON |
| 41 | +cmake --build . |
| 42 | + |
| 43 | +# 3. Run integration tests |
| 44 | +cd /path/to/dmdevfs |
| 45 | +./tests/run_integration_tests.sh /tmp/dmvfs/build/tests/fs_tester build/dmf/dmdevfs.dmf |
| 46 | +``` |
| 47 | + |
| 48 | +#### Manual Testing with fs_tester |
| 49 | + |
| 50 | +The fs_tester can test DMDEVFS in read-only mode: |
| 51 | + |
| 52 | +```bash |
| 53 | +# Clone dmvfs if you haven't already |
| 54 | +git clone https://github.com/choco-technologies/dmvfs.git |
| 55 | + |
| 56 | +# Build fs_tester |
| 57 | +cd dmvfs |
| 58 | +mkdir build && cd build |
| 59 | +cmake .. -DDMVFS_BUILD_TESTS=ON |
| 60 | +cmake --build . |
| 61 | + |
| 62 | +# Run tests on dmdevfs module (read-only mode) |
| 63 | +./tests/fs_tester --read-only-fs path/to/dmdevfs.dmf |
| 64 | +``` |
| 65 | + |
| 66 | +## Test Coverage |
| 67 | + |
| 68 | +Current automated tests verify: |
| 69 | +- Module compilation succeeds |
| 70 | +- Module output files are generated |
| 71 | +- Build system integration works correctly |
| 72 | + |
| 73 | +With fs_tester integration: |
| 74 | +- File system interface implementation |
| 75 | +- Read operations on device drivers |
| 76 | +- Directory operations |
| 77 | +- File metadata operations |
| 78 | + |
| 79 | +Future test improvements could include: |
| 80 | +- Device driver mock for testing file operations |
| 81 | +- Write operation tests (if supported by drivers) |
| 82 | +- Performance benchmarks |
| 83 | + |
| 84 | +## Note on Test Limitations |
| 85 | + |
| 86 | +DMDEVFS is a device driver-based filesystem that depends on: |
| 87 | +1. Device driver modules (dmdrvi implementations) |
| 88 | +2. Configuration files specifying device mappings |
| 89 | +3. Actual hardware or mocked drivers |
| 90 | + |
| 91 | +Full integration testing requires these dependencies to be available. The current test suite focuses on verifying the core module builds correctly. Device driver integration testing should be done with specific driver implementations. |
| 92 | + |
| 93 | +## CI/CD Testing |
| 94 | + |
| 95 | +The CI pipeline automatically: |
| 96 | +1. Builds the dmdevfs module |
| 97 | +2. Runs build verification tests |
| 98 | +3. Verifies the module files are created |
| 99 | + |
| 100 | +To add fs_tester to CI in the future, the workflow would need to: |
| 101 | +1. Clone and build dmvfs |
| 102 | +2. Run fs_tester against the built dmdevfs module |
| 103 | +3. Report results |
| 104 | + |
| 105 | +This can be added once device driver mocks or test drivers are available. |
0 commit comments