Main function for testing the integration.
()
| 143 | |
| 144 | |
| 145 | def main(): |
| 146 | """Main function for testing the integration.""" |
| 147 | import argparse |
| 148 | |
| 149 | parser = argparse.ArgumentParser(description="Docker-based QEMU Test Integration") |
| 150 | parser.add_argument( |
| 151 | "command", |
| 152 | choices=["test", "install", "integrate", "check"], |
| 153 | help="Command to execute", |
| 154 | ) |
| 155 | parser.add_argument("--firmware", type=Path, help="Firmware path for test command") |
| 156 | parser.add_argument( |
| 157 | "--machine", |
| 158 | type=str, |
| 159 | default="esp32", |
| 160 | help="QEMU machine type (esp32, esp32c3, esp32s3)", |
| 161 | ) |
| 162 | parser.add_argument( |
| 163 | "--timeout", type=int, default=30, help="Test timeout in seconds" |
| 164 | ) |
| 165 | |
| 166 | args = parser.parse_args() |
| 167 | |
| 168 | integration = QEMUTestIntegration() |
| 169 | |
| 170 | if args.command == "check": |
| 171 | print(f"Docker available: {integration.docker_available}") |
| 172 | print(f"Selected runner: {integration.select_runner()}") |
| 173 | return 0 |
| 174 | |
| 175 | elif args.command == "install": |
| 176 | success = integration.install_qemu() |
| 177 | return 0 if success else 1 |
| 178 | |
| 179 | elif args.command == "integrate": |
| 180 | success = integrate_with_test_framework() |
| 181 | return 0 if success else 1 |
| 182 | |
| 183 | elif args.command == "test": |
| 184 | if not args.firmware: |
| 185 | print("ERROR: --firmware required for test command", file=sys.stderr) |
| 186 | return 1 |
| 187 | |
| 188 | return integration.run_qemu_test( |
| 189 | firmware_path=args.firmware, |
| 190 | timeout=args.timeout, |
| 191 | machine=args.machine, |
| 192 | ) |
| 193 | |
| 194 | return 0 |
| 195 | |
| 196 | |
| 197 | if __name__ == "__main__": |
no test coverage detected