Skip to content

Conversation

@anna-nexthop
Copy link

Pre-submission checklist

  • 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
  • pre-commit run

Explicitly control when the config should be modified to set AUTOLOAD_BOARD_SETTINGS instead of autodetecting montblanc since not all montblancs are reference boards. As well, modified a copy of the original config to preserve the original and passed in the copy to the tests.

Verified the help output:

[root@fboss101 fboss]# ./bin/run_test.py --help
Setting fboss environment variables
usage: run_test.py [-h] [--coldboot_only] [--filter FILTER] [--filter_file FILTER_FILE] [--list_tests] [--config CONFIG] [--qsfp-config QSFP_CONFIG] [--sai_replayer_logging SAI_REPLAYER_LOGGING]
                   [--skip-known-bad-tests SKIP_KNOWN_BAD_TESTS] [--known-bad-tests-file KNOWN_BAD_TESTS_FILE] [--unsupported-tests-file UNSUPPORTED_TESTS_FILE] [--mgmt-if MGMT_IF] [--sai-bin SAI_BIN] [--oss]
                   [--no-oss] [--fruid-path FRUID_PATH] [--simulator SIMULATOR] [--sai_logging SAI_LOGGING] [--fboss_logging FBOSS_LOGGING] [--setup-for-coldboot SETUP_FOR_COLDBOOT]
                   [--setup-for-warmboot SETUP_FOR_WARMBOOT] [--run-on-reference-board]
                   {bcm,sai,qsfp,link,sai_agent} ...

Run tests.
...
  --setup-for-warmboot SETUP_FOR_WARMBOOT
                        run script before warm boot run
  --run-on-reference-board
                        Modify SAI settings to run on reference board instead of real product

Ran the script with the option enabled, verified that a copy of the config was made and the original remained unchanged.

[root@fboss101 fboss]# ./bin/run_test.py sai --filter=*HwEmptyTest.CheckInit* --config /opt/fboss/share/hw_test_configs/montblanc.agent.materialized_JSON --run-on-reference-board
Setting fboss environment variables
The --skip-known-bad-tests option is not set, therefore unsupported tests will be run.
HwEmptyTest.
  CheckInit

Using a modified config file {self._config_file_modified} for test runs
Replaced AUTOLOAD_BOARD_SETTINGS: 0 by AUTOLOAD_BOARD_SETTINGS: 1 in file /tmp/modified-montblanc.agent.materialized_JSON
...
[root@fboss101 fboss]# grep -l 'AUTOLOAD_BOARD_SETTINGS: 1' /tmp/modified-montblanc.agent.materialized_JSON
/tmp/modified-montblanc.agent.materialized_JSON
[root@fboss101 fboss]# grep -l 'AUTOLOAD_BOARD_SETTINGS: 0' /tmp/modified-montblanc.agent.materialized_JSON
[root@fboss101 fboss]# grep -l 'AUTOLOAD_BOARD_SETTINGS: 1' /opt/fboss/share/hw_test_configs/montblanc.agent.materialized_JSON
[root@fboss101 fboss]# grep -l 'AUTOLOAD_BOARD_SETTINGS: 0' /opt/fboss/share/hw_test_configs/montblanc.agent.materialized_JSON
/opt/fboss/share/hw_test_configs/montblanc.agent.materialized_JSON
[root@fboss101 fboss]#

@meta-cla
Copy link

meta-cla bot commented Nov 25, 2025

Hi @anna-nexthop!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@anna-nexthop anna-nexthop marked this pull request as ready for review November 25, 2025 21:34
@meta-cla
Copy link

meta-cla bot commented Nov 26, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the CLA Signed label Nov 26, 2025
**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`

Explicitly control when the config should be modified to set
AUTOLOAD_BOARD_SETTINGS instead of autodetecting montblanc since not all
montblancs are reference boards. As well, modified a copy of the
original config to preserve the original and passed in the copy to the
tests.

Verified the help output:
```
[root@fboss101 fboss]# ./bin/run_test.py --help
Setting fboss environment variables
usage: run_test.py [-h] [--coldboot_only] [--filter FILTER] [--filter_file FILTER_FILE] [--list_tests] [--config CONFIG] [--qsfp-config QSFP_CONFIG] [--sai_replayer_logging SAI_REPLAYER_LOGGING]
                   [--skip-known-bad-tests SKIP_KNOWN_BAD_TESTS] [--known-bad-tests-file KNOWN_BAD_TESTS_FILE] [--unsupported-tests-file UNSUPPORTED_TESTS_FILE] [--mgmt-if MGMT_IF] [--sai-bin SAI_BIN] [--oss]
                   [--no-oss] [--fruid-path FRUID_PATH] [--simulator SIMULATOR] [--sai_logging SAI_LOGGING] [--fboss_logging FBOSS_LOGGING] [--setup-for-coldboot SETUP_FOR_COLDBOOT]
                   [--setup-for-warmboot SETUP_FOR_WARMBOOT] [--run-on-reference-board]
                   {bcm,sai,qsfp,link,sai_agent} ...

Run tests.
...
  --setup-for-warmboot SETUP_FOR_WARMBOOT
                        run script before warm boot run
  --run-on-reference-board
                        Modify SAI settings to run on reference board instead of real product
```

Ran the script with the option enabled, verified that a copy of the
config was made and the original remained unchanged.
```
[root@fboss101 fboss]# ./bin/run_test.py sai --filter=*HwEmptyTest.CheckInit* --config /opt/fboss/share/hw_test_configs/montblanc.agent.materialized_JSON --run-on-reference-board
Setting fboss environment variables
The --skip-known-bad-tests option is not set, therefore unsupported tests will be run.
HwEmptyTest.
  CheckInit

Using a modified config file {self._config_file_modified} for test runs
Replaced AUTOLOAD_BOARD_SETTINGS: 0 by AUTOLOAD_BOARD_SETTINGS: 1 in file /tmp/modified-montblanc.agent.materialized_JSON
...
[root@fboss101 fboss]# grep -l 'AUTOLOAD_BOARD_SETTINGS: 1' /tmp/modified-montblanc.agent.materialized_JSON
/tmp/modified-montblanc.agent.materialized_JSON
[root@fboss101 fboss]# grep -l 'AUTOLOAD_BOARD_SETTINGS: 0' /tmp/modified-montblanc.agent.materialized_JSON
[root@fboss101 fboss]# grep -l 'AUTOLOAD_BOARD_SETTINGS: 1' /opt/fboss/share/hw_test_configs/montblanc.agent.materialized_JSON
[root@fboss101 fboss]# grep -l 'AUTOLOAD_BOARD_SETTINGS: 0' /opt/fboss/share/hw_test_configs/montblanc.agent.materialized_JSON
/opt/fboss/share/hw_test_configs/montblanc.agent.materialized_JSON
[root@fboss101 fboss]#
```
@anna-nexthop anna-nexthop force-pushed the anna.nos-510.run_test_autoload branch from b4c54de to b006332 Compare December 3, 2025 18:47
self._config_file_modified = f"/tmp/modified-{config_filename}"
shutil.copy2(conf_file, self._config_file_modified)

print("Using a modified config file {self._config_file_modified} for test runs")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print("Using a modified config file {self._config_file_modified} for test runs")
print(f"Using a modified config file {self._config_file_modified} for test runs")

Comment on lines 288 to 291
def __init__(self):
super().__init__()
self._config_file_modified = None

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove this since you are returning the path in _backup_and_modify_config anyways

@marif-nexthop
Copy link
Contributor

marif-nexthop commented Dec 5, 2025

Thanks for the review, @KevinYakar . I have addressed both your review comments in the latest diff. Please let me know if any other change is needed in this PR.

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.

3 participants