Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor scripts to use config.py instead of config.pl #178

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Harry-Ramsey
Copy link

@Harry-Ramsey Harry-Ramsey commented Oct 7, 2024

This commit refactors Windows testing scripts to use config.py instead of config.pl because config.pl is being removed from the Mbed TLS repository.

This is required for issue in Mbed TLS: 9663
This is required for pull request in Mbed TLS: 9666

Test runs on 8e4283c:

))
try:
enable_output = subprocess.run(
[self.perl_command, self.config_pl_location, "full"],
[self.config_py_location, "full"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we need to invoke the Python interpreter explicitly? Windows doesn't understand shebang lines, and I don't know if our CI systems are configured to have *.py files executable via python.exe.

Copy link
Author

Choose a reason for hiding this comment

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

I have resolved this now, I still need to test it however Docker on MacOS is proving to be a bit troublesome.

self.selftest_exe = "selftest.exe"
self.mingw_command = "mingw32-make"
self.git_command = "git"
self.perl_command = "perl"
Copy link
Contributor

Choose a reason for hiding this comment

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

Historical note: we need this script to run with all maintained branches, not just the latest. The last supported branch of Mbed TLS that had only config.pl and not config.py was 2.16. The oldest still-supported branch is 2.28, and it has config.py. Therefore it's ok to remove support for branches that don't have config.py.

@Harry-Ramsey Harry-Ramsey force-pushed the refactor-config-pl-config-py-main branch from 5a1c2d3 to 8315fe3 Compare October 8, 2024 15:03
@Harry-Ramsey
Copy link
Author

I haven't been able to fully test this due to various docker issues with MacOS. Would anyone be able to run this on their docker setup to ensure it passes successfully?

mpg
mpg previously approved these changes Nov 14, 2024
Copy link
Contributor

@mpg mpg left a comment

Choose a reason for hiding this comment

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

Looks good to me on code inspection.

What's missing IMO, rather than local testing with docker on someone's machine, is testing on the actual CI, because that's what we ultimately care about.

@mpg
Copy link
Contributor

mpg commented Nov 14, 2024

@Harry-Ramsey I'm not sure if we have documentation about this, but I think what you want to do is:

  • go to https://jenkins-mbedtls.oss.arm.com/job/mbedtls-release-ci-testing/
  • (log in if you're not logged in already)
  • click "build with parameters"
  • check at least "windows testing"
  • push your branch to this repo (eg git push origin refactor-confif-pl-config-py-main:dev/harry/refactor-confif-pl-config-py-main)
  • select it under "TEST_BRANCH"
  • start the job, add a link to it in the PR description, and have a look at the results once it completes
  • do the same for the Internal CI.

(Disclaimer: I don't test changes on mbedtls-test that often - if I got it wrong, @gilles-peskine-arm or @bensze01 should be able to correct me.)

This commit refactors Windows testing scripts to use config.py instead
of config.pl because config.pl is being removed from the Mbed TLS
repository.

Signed-off-by: Harry Ramsey <[email protected]>
@Harry-Ramsey Harry-Ramsey force-pushed the refactor-config-pl-config-py-main branch from 8315fe3 to 30b2f77 Compare November 14, 2024 11:23
@Harry-Ramsey
Copy link
Author

@mpg I believe I do not have permission to push to mbedtls-test as git is giving me a permission error.

@mpg
Copy link
Contributor

mpg commented Nov 14, 2024

Can you try again? I believe permissions have been fixed now.

@Harry-Ramsey
Copy link
Author

Thanks, building now. The result can be found at 729.

@Harry-Ramsey Harry-Ramsey self-assigned this Nov 14, 2024
@gilles-peskine-arm
Copy link
Contributor

gilles-peskine-arm commented Nov 18, 2024

I'm not sure if we have documentation about this,

It's waiting for review ☹️ #126

if I got it wrong, @gilles-peskine-arm or @bensze01 should be able to correct me

That looks right to me.

Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

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

There's a change (no extension → .exe) that seems unneeded and risky. Other than that, looks good to me on code inspection.

The test run looks fine, but please also run one on 2.28 (which has slightly different requirements) and one on OpenCI (which has a similar but not identical Windows installation). They can be the same run.

self.selftest_exe = "selftest.exe"
self.mingw_command = "mingw32-make"
self.git_command = "git"
self.perl_command = "perl"
self.python_command = "python.exe"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why python.exe and not python? What if python is a .bat wrapper?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I made that change under the pretense from your other comment that python.exe is how python is always invoked on Windows. (I haven't done much development on Windows so I do not know the lay of the land).

This commit replaces python.exe with python to run python scripts.

Signed-off-by: Harry Ramsey <[email protected]>
@Harry-Ramsey
Copy link
Author

Latest Ci job: 730

Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

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

LGTM on code inspection — now waiting for the test jobs to complete

@gilles-peskine-arm
Copy link
Contributor

https://jenkins-mbedtls.oss.arm.com/job/mbedtls-release-ci-testing/730/ looks fine. What about 2.28 and OpenCI?

@Harry-Ramsey
Copy link
Author

https://jenkins-mbedtls.oss.arm.com/job/mbedtls-release-ci-testing/730/ looks fine. What about 2.28 and OpenCI?

I believe for OpenCI this should work but how would I go about testing it? As for 2.28, this will fail because the script isn't being backported to that version. What is the appropriate solution for seperating them out?

@gilles-peskine-arm
Copy link
Contributor

@Harry-Ramsey Please start a similar job on OpenCI (https://mbedtls.trustedfirmware.org/job/mbedtls-release-ci-testing/). I'd prefer for you to do it so that you can make sure you have permission.

This should work on 2.28, it does have config.py. But I want a successful CI run, just to be sure that it does work.

@Harry-Ramsey
Copy link
Author

I do not have permission to run anything on that CI :(

@Harry-Ramsey
Copy link
Author

Build 298

@Harry-Ramsey
Copy link
Author

Build 299. It appears that this works for 2.28 so perhaps the changes in MbedTLS can be backported to 2.28?

Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

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

LGTM on code reading and from the CI results

@gilles-peskine-arm
Copy link
Contributor

Yes, we've now confirmed this works on 2.28.

perhaps the changes in MbedTLS can be backported to 2.28?

Sorry, what changes? This was expected to work on 2.28, and it's now confirmed to work. What would we backport?

@gilles-peskine-arm gilles-peskine-arm added the size-xs Estimated task size: extra small (a few hours at most) label Nov 21, 2024
@Harry-Ramsey
Copy link
Author

Harry-Ramsey commented Nov 21, 2024

Sorry, what changes? This was expected to work on 2.28, and it's now confirmed to work. What would we backport?

The changes are removing obsolete CI scripts from MbedTLS. The original goal was to do it for development but since the python script also exists in 2.28, I see no reason why it cannot be removed from 2.28 other than perhaps external reason?
Mbed-TLS/mbedtls#9666

@gilles-peskine-arm
Copy link
Contributor

Oh ok. No, we shouldn't remove config.pl in LTS branches because it might be used in users' build scripts. Especially in 2.28.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: review priority-high size-xs Estimated task size: extra small (a few hours at most)
Projects
Development

Successfully merging this pull request may close these issues.

3 participants