{"id":47795080,"url":"https://github.com/eclipse-score/qnx_unit_tests","last_synced_at":"2026-04-05T18:01:11.462Z","repository":{"id":348233805,"uuid":"1196244695","full_name":"eclipse-score/qnx_unit_tests","owner":"eclipse-score","description":"Infrastructure for running unit tests in QNX VMs","archived":false,"fork":false,"pushed_at":"2026-04-03T18:16:09.000Z","size":101,"stargazers_count":0,"open_issues_count":2,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T18:33:50.059Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eclipse-score.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-30T14:08:00.000Z","updated_at":"2026-04-02T19:59:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/eclipse-score/qnx_unit_tests","commit_stats":null,"previous_names":["eclipse-score/qnx_unit_tests"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eclipse-score/qnx_unit_tests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-score%2Fqnx_unit_tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-score%2Fqnx_unit_tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-score%2Fqnx_unit_tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-score%2Fqnx_unit_tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eclipse-score","download_url":"https://codeload.github.com/eclipse-score/qnx_unit_tests/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-score%2Fqnx_unit_tests/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31407480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-03T16:14:02.004Z","updated_at":"2026-04-05T18:01:11.451Z","avatar_url":"https://github.com/eclipse-score.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## QNX Unit Tests\n\nStandalone Bazel module project for running C++ unit tests inside QEMU microvirtual machines on QNX 8 (x86_64).\n\n### Directory Structure\n\n```\nqnx_unit_tests/\n├── .bazelrc               # Bazel config (qnx-x86_64 cross-compilation)\n├── .bazelversion          # Pinned Bazel version (8.6.0)\n├── MODULE.bazel           # Bzlmod dependencies (QCC toolchain, IFS, googletest)\n├── BUILD                  # Top-level build targets (IFS images, pkg_files)\n├── cc_test_qnx.bzl        # Macro wrapping cc_test for QNX microvm execution\n├── x86_64_qnx8/           # x86_64 QNX 8 specific files\n│   ├── init.build.template\n│   ├── run_qemu.sh\n│   ├── run_qemu_shell.sh\n│   ├── startup.sh\n│   └── tools.build\n├── common/                # Shared scripts and drivers\n│   ├── run_test.sh\n│   └── virtio9p/          # 9P2000.L resource manager for host-guest file sharing\n├── third_party/\n│   ├── BUILD              # Stubs for QNX system libraries (libslog2, libpci)\n│   └── rules_imagefs/     # Local checkout of score_rules_imagefs (IFS rule)\n└── test/                  # Example test\n    ├── BUILD\n    ├── data.txt\n    └── main.cpp\n```\n\n### Prerequisites\n\n- Bazel 8.6.0 (via Bazelisk)\n- QEMU (`qemu-system-x86_64`)\n- KVM access (optional, but strongly recommended for performance)\n- QNX SDP 8.0 credentials (for toolchain download)\n\n### How It Works\n\nThe `cc_test_qnx` macro wraps a standard `cc_test` target for execution inside a QEMU microvm running QNX:\n\n1. The test binary and its runfiles are packaged into a tar archive\n2. An IFS boot image is built containing the QNX kernel, startup scripts, and the virtio-9p driver\n3. QEMU boots the IFS image, mounts the test archive via virtio-9p, and executes the test\n4. Test results (XML, coverage) are extracted from the shared directory after execution\n\n### Usage\n\nAdd a `cc_test` and wrap it with `cc_test_qnx` (see `test/BUILD`):\n\n```python\nload(\"@rules_cc//cc:defs.bzl\", \"cc_test\")\nload(\"//:cc_test_qnx.bzl\", \"cc_test_qnx\")\n\ncc_test(\n    name = \"main_cpp\",\n    srcs = [\"main.cpp\"],\n    linkstatic = True,\n    deps = [\n        \"@googletest//:gtest\",\n        \"@googletest//:gtest_main\",\n    ],\n)\n\ncc_test_qnx(\n    name = \"main_cpp_qnx\",\n    cc_test = \":main_cpp\",\n)\n```\n\nRun the test:\n\n```shell\nbazel test --config=qnx-x86_64 //test:main_cpp_qnx\n```\n\nStream test output (useful for debugging):\n\n```shell\nbazel test --config=qnx-x86_64 //test:main_cpp_qnx --test_output=streamed\n```\n\n### Shell Mode\n\nLaunch an interactive QNX shell inside the microvm:\n\n```shell\nbazel run --config=qnx-x86_64 //test:main_cpp_qnx_shell\n```\n\nThe test binary is available at `/opt/tests/cc_test_qnx`. Run it directly:\n\n```shell\n/opt/tests/cc_test_qnx\n```\n\n### Debugging\n\nThe shell mode supports remote debugging via GDB. Specify a debug port:\n\n```shell\nbazel run -c dbg --config=qnx-x86_64 //test:main_cpp_qnx_shell -- --debug-port 38080\n```\n\nThen connect from the host:\n\n```shell\nntox86_64-gdb \\\n    -ex \"target qnx 127.0.0.1:38080\" \\\n    -ex \"set nto-cwd /opt/tests\" \\\n    -ex \"set nto-executable /opt/tests/cc_test_qnx\" \\\n    \u003cpath-to-debug-binary-in-bazel-bin\u003e\n```\n\n### Excluding Tests\n\nThe `cc_test_qnx` macro supports filtering out specific test cases:\n\n```python\ncc_test_qnx(\n    name = \"main_cpp_qnx\",\n    cc_test = \":main_cpp\",\n    excluded_tests_filter = [\n        \"FooTest.Test1\",     # Skip a single test\n        \"BarTest.*\",         # Skip an entire suite\n    ],\n)\n```\n\n### Environment Variables\n\n| Variable | Default | Description |\n|---|---|---|\n| `DISABLE_KVM` | `0` | Set to `1` to disable KVM acceleration |\n| `QEMU_CPU` | `host` | QEMU CPU model (e.g. `Cascadelake-Server-v5`) |\n| `FSDEV_PATH` | (auto) | Override the virtio-9p shared directory path |\n\nFor tests, pass via `--test_env`:\n\n```shell\nbazel test --config=qnx-x86_64 //test:main_cpp_qnx --test_env=DISABLE_KVM=1\nbazel test --config=qnx-x86_64 //test:main_cpp_qnx --test_env=QEMU_CPU=Cascadelake-Server-v5\n```\n\nFor shell runs, set directly:\n\n```shell\nDISABLE_KVM=1 bazel run --config=qnx-x86_64 //test:main_cpp_qnx_shell\n```\n\n### Dependencies\n\nThis project uses the [Eclipse SCORE](https://github.com/eclipse-score) Bazel ecosystem:\n\n| Module | Purpose |\n|---|---|\n| `score_bazel_cpp_toolchains` | QCC cross-compiler (GCC 12.2.0 for QNX SDP 8.0) |\n| `score_rules_imagefs` | QNX IFS image generation (`qnx_ifs` rule) |\n| `score_bazel_platforms` | Platform definitions and config_settings for QNX |\n| `googletest` | Google Test framework |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-score%2Fqnx_unit_tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feclipse-score%2Fqnx_unit_tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-score%2Fqnx_unit_tests/lists"}