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

Run tests on M1 MacOS runners. #1030

Merged
merged 2 commits into from
Feb 10, 2024
Merged

Conversation

bcoconni
Copy link
Member

@bcoconni bcoconni commented Feb 3, 2024

Until now we were only testing that JSBSim was successfully compiling on Apple M1 chips using cross-compilation on Intel MacOS GitHub runners. The resulting binaries were not tested on the actual hardware so we were happily assuming that if it compiles then it runs swiftly. And everyone knows how reliable that criterion is 😄

These dark ages are now over: GitHub just introduced M1 MacOS runners, so this PR implements the testing of JSBSim on that platform.

Note that the floating point precision requirement had to be slightly relaxed at some places in the unit tests ...despite using the flag -fno-fast-math. If someone who has access to an M1 Macbook or equivalent knows better then by all means submit fixes 👍

Note also that the issue that was fixed by PR #143 (random failure of TestActuator.py) is resurfacing with M1 MacOS runners. This has been fixed again by extending further the waiting time of test_regression_bug_1503:

def test_regression_bug_1503(self):
# First, the execution time of the script c1724.xml is measured. It
# will be used as a reference to check if JSBSim hangs or not.
fdm = self.create_fdm()
start_time = time.time()
self.ScriptExecution(fdm)
exec_time = time.time() - start_time
# Delete the FDM instance to make sure that all files are closed and
# released before running the same script in another process.
del fdm
# Now the copy of the aircraft definition file will be altered: the
# <rate_limit> element is split in two: one with the 'decr' sense, the
# other with 'incr' sense.
actuator_element = self.tree.getroot().find('flight_control/channel/actuator//rate_limit/..')
rate_element = actuator_element.find('rate_limit')
rate_element.attrib['sense'] = 'decr'
new_rate_element = et.SubElement(actuator_element, 'rate_limit')
new_rate_element.attrib['sense'] = 'incr'
new_rate_element.text = str(float(rate_element.text) * 0.5)
self.tree.write(os.path.join('aircraft', self.aircraft_name,
self.aircraft_name+'.xml'))
# A new process is created that launches the script. We wait for 10
# times the reference execution time for the script completion. Beyond
# that time, if the process is not completed, it is terminated and the
# test is failed.
p = Process(target=SubProcessScriptExecution,
args=(self.sandbox, self.script_path))
p.start()
p.join(exec_time * 20.0) # Wait 20 times the reference time
alive = p.is_alive()
if alive:
p.terminate()
self.assertFalse(alive, msg="The script has hung")

Copy link

codecov bot commented Feb 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6f0c4d8) 24.87% compared to head (b46fd66) 24.87%.
Report is 2 commits behind head on master.

❗ Current head b46fd66 differs from pull request most recent head d63bf5f. Consider uploading reports for the commit d63bf5f to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1030   +/-   ##
=======================================
  Coverage   24.87%   24.87%           
=======================================
  Files         168      168           
  Lines       18908    18908           
=======================================
  Hits         4704     4704           
  Misses      14204    14204           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bcoconni
Copy link
Member Author

bcoconni commented Feb 3, 2024

And in case someone asks: the test job on M1 chips uses Python 3.10 (instead of Python 3.8 for other platforms) because Python<=3.9 is not available on the M1 MacOS runners.

@bcoconni bcoconni changed the title Add a test on M1 MacOS runners. Run tests on M1 MacOS runners. Feb 3, 2024
@bcoconni bcoconni merged commit fbd7c05 into JSBSim-Team:master Feb 10, 2024
27 checks passed
@bcoconni bcoconni deleted the M1_chips_tests branch February 10, 2024 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant