Skip to content

Conversation

@raghav-nexthop
Copy link

@raghav-nexthop raghav-nexthop commented Jan 9, 2026

Pre-submission checklist

  • [X ] I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • [ X] pre-commit run

Summary

Integrate distro_cli Python unit tests into the FBOSS CMake build system to enable automated testing in CI/CD pipelines.

  • Add FbossImageDistroCliTests.cmake to discover and register Python unit tests
  • Configure test discovery for distro_cli modules (builder, cmds, lib, tools)
  • Update root CMakeLists.txt to include distro_cli test suite
  • Enable distro_cli tests in GitHub Actions workflow
  • Update distro_cli README with build and test instructions

The CMake configuration automatically discovers all *_test.py files and registers them as CTest targets, allowing tests to run via 'ctest' or 'make test'.

Test Plan

git checkout raghav.distro-cli-cmake-part1 && cd fboss-image/distro_cli && python3 -m pytest tests/ -v
Switched to branch 'raghav.distro-cli-cmake-part1'
=================================================================== test session starts ====================================================================
platform linux -- Python 3.10.12, pytest-8.4.1, pluggy-1.6.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /work/raghav/private-fboss/fboss-image/distro_cli
collected 32 items                                                                                                                                         

tests/build_test.py::TestBuildCommand::test_build_all_stub PASSED                                                                                    [  3%]
tests/build_test.py::TestBuildCommand::test_build_command_exists PASSED                                                                              [  6%]
tests/build_test.py::TestBuildCommand::test_build_specific_components_stub PASSED                                                                    [  9%]
tests/cli_test.py::ValidatePathTest::test_validate_path_converts_to_path PASSED                                                                      [ 12%]
tests/cli_test.py::ValidatePathTest::test_validate_path_existing_file PASSED                                                                         [ 15%]
tests/cli_test.py::ValidatePathTest::test_validate_path_nonexistent_file_raises PASSED                                                               [ 18%]
tests/cli_test.py::ValidatePathTest::test_validate_path_nonexistent_file_without_check PASSED                                                        [ 21%]
tests/cli_test.py::CommandGroupTest::test_add_command_to_group PASSED                                                                                [ 25%]
tests/cli_test.py::CommandGroupTest::test_add_command_with_arguments PASSED                                                                          [ 28%]
tests/cli_test.py::CommandGroupTest::test_command_group_creation PASSED                                                                              [ 31%]
tests/cli_test.py::CommandGroupTest::test_command_group_with_arguments PASSED                                                                        [ 34%]
tests/cli_test.py::CLITest::test_add_command PASSED                                                                                                  [ 37%]
tests/cli_test.py::CLITest::test_add_command_group PASSED                                                                                            [ 40%]
tests/cli_test.py::CLITest::test_add_command_with_arguments PASSED                                                                                   [ 43%]
tests/cli_test.py::CLITest::test_cli_creation PASSED                                                                                                 [ 46%]
tests/cli_test.py::CLITest::test_cli_with_verbose_flag PASSED                                                                                        [ 50%]
tests/cli_test.py::CLITest::test_cli_without_verbose_flag PASSED                                                                                     [ 53%]
tests/device_test.py::TestDeviceCommands::test_device_commands_exist PASSED                                                                          [ 56%]
tests/device_test.py::TestDeviceCommands::test_getip_stub PASSED                                                                                     [ 59%]
tests/device_test.py::TestDeviceCommands::test_image_stub PASSED                                                                                     [ 62%]
tests/device_test.py::TestDeviceCommands::test_image_upstream_stub PASSED                                                                            [ 65%]
tests/device_test.py::TestDeviceCommands::test_reprovision_stub PASSED                                                                               [ 68%]
tests/device_test.py::TestDeviceCommands::test_ssh_stub PASSED                                                                                       [ 71%]
tests/device_test.py::TestDeviceCommands::test_update_stub PASSED                                                                                    [ 75%]
tests/image_builder_test.py::TestImageBuilder::test_build_all_stub PASSED                                                                            [ 78%]
tests/image_builder_test.py::TestImageBuilder::test_build_components_stub PASSED                                                                     [ 81%]
tests/image_builder_test.py::TestImageBuilder::test_builder_initialization PASSED                                                                    [ 84%]
tests/manifest_test.py::TestImageManifest::test_has_component PASSED                                                                                 [ 87%]
tests/manifest_test.py::TestImageManifest::test_load_manifest PASSED                                                                                 [ 90%]
tests/manifest_test.py::TestImageManifest::test_missing_components PASSED                                                                            [ 93%]
tests/manifest_test.py::TestImageManifest::test_resolve_path_relative PASSED                                                                         [ 96%]
tests/manifest_test.py::TestImageManifest::test_resolve_path_url PASSED                                                                              [100%]

==================================================================== 32 passed in 0.10s ====================================================================

Summary:

Here an RPM specfile and surrounding machinery is added to build an
FBOSS-compatible Linux kernel from vanilla Linux sources which is
compatible with CentOS. On top of this reference configuration,
additional local changes from `fboss-local-overrides.yaml` are applied
prior to building.

To use, inside an FBOSS build container, run:

    # fboss-image/kernel/scripts/build_kernel.sh 6.4.3 out
    ...
    Kernel RPM build complete!
    Output files:
    out/x86_64/kernel-modules-6.4.3-1.fboss.el9.x86_64.rpm
    out/x86_64/kernel-headers-6.4.3-1.fboss.el9.x86_64.rpm
    out/x86_64/kernel-core-6.4.3-1.fboss.el9.x86_64.rpm
    out/x86_64/kernel-devel-6.4.3-1.fboss.el9.x86_64.rpm
    out/BUILD/linux-6.4.3/kernel/config_data.gz
    out/SRPMS/kernel-6.4.3-1.fboss.el9.src.rpm
    out/kernel-6.4.3.rpms.tar.gz
    out/kernel-6.4.3-1.fboss.el9.src.rpm
    out/RPMS/x86_64/kernel-modules-6.4.3-1.fboss.el9.x86_64.rpm
    out/RPMS/x86_64/kernel-headers-6.4.3-1.fboss.el9.x86_64.rpm
    out/RPMS/x86_64/kernel-core-6.4.3-1.fboss.el9.x86_64.rpm
    out/RPMS/x86_64/kernel-devel-6.4.3-1.fboss.el9.x86_64.rpm
    # ls fboss-image/kernel/dist/build-6.4.3/out/
    kernel-6.4.3-1.fboss.el9.src.rpm  kernel-core-6.4.3-1.fboss.el9.x86_64.rpm   kernel-headers-6.4.3-1.fboss.el9.x86_64.rpm
    kernel-6.4.3.rpms.tar.gz          kernel-devel-6.4.3-1.fboss.el9.x86_64.rpm  kernel-modules-6.4.3-1.fboss.el9.x86_64.rpm
Integrate distro_cli Python unit tests into the FBOSS CMake build system to enable automated testing in CI/CD pipelines.

- Add FbossImageDistroCliTests.cmake to discover and register Python unit tests
- Configure test discovery for distro_cli modules (builder, cmds, lib, tools)
- Update root CMakeLists.txt to include distro_cli test suite
- Enable distro_cli tests in GitHub Actions workflow
- Update distro_cli README with build and test instructions

The CMake configuration automatically discovers all *_test.py files and registers them as CTest targets, allowing tests to run via 'ctest' or 'make test'.
@meta-cla meta-cla bot added the CLA Signed label Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant