Skip to content

Commit 2a0c4ea

Browse files
brettleCoolSpy3omichel
authored
Fix-test-suite-not-run-on-macos (#6631)
Fixes to run test_suite.yml during macos CI (if "test suite mac" label is present). * Make sure the Contents/Frameworks folder is created. * Set WEBOTS_HOME_PATH such that tests can find Makefile.include during CI. * Change WEBOTS_HOME to Webots.app and add logic to test_suite.py to find webots executable. * Get qt_warning_filters.conf from correct location on macos. * Ignore (but warn about) error trying to connect to background Webots on MacOS. * On Mac, timeout test after 60 minutes instead of 10. * Use macos-13 runner instead of macos-14. The former has twice as much RAM as the latter. * Install urdfdom during macos CI because it is needed by tests suite. * Assert that move succeeds. * Print age of ode_tmp.dif so we can see how long we should wait on macos during CI. * Allow up to 20 seconds for world reload. * Skip billboard.wbt test during macos CI. The test passes locally, so the failure is presumably due to the CI server being headless. * Only increase timeout on macos. --------- Co-authored-by: CoolSpy3 <[email protected]> Co-authored-by: Olivier Michel <[email protected]>
1 parent 8d0ecd7 commit 2a0c4ea

File tree

5 files changed

+33
-14
lines changed

5 files changed

+33
-14
lines changed

.github/workflows/test_suite_mac.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
if: ${{ contains(github.event.pull_request.labels.*.name, 'test webots build') }}
2020
strategy:
2121
matrix:
22-
os: [macos-14]
22+
os: [macos-13]
2323
runs-on: ${{ matrix.os }}
2424
steps:
2525
- uses: actions/checkout@v3
@@ -33,7 +33,7 @@ jobs:
3333
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'test distribution') || contains(github.event.pull_request.labels.*.name, 'test suite') }}
3434
strategy:
3535
matrix:
36-
os: [macos-14]
36+
os: [macos-13]
3737
runs-on: ${{ matrix.os }}
3838
steps:
3939
- uses: actions/checkout@v3
@@ -67,10 +67,10 @@ jobs:
6767
distribution/*.dmg
6868
test-suite:
6969
needs: build
70-
if: ${{ contains(github.event.pull_request.labels.*.name, 'test suite') }}
70+
if: ${{ contains(github.event.pull_request.labels.*.name, 'test suite mac') }}
7171
strategy:
7272
matrix:
73-
os: [macos-14]
73+
os: [macos-13]
7474
runs-on: ${{ matrix.os }}
7575
steps:
7676
- uses: actions/checkout@v3
@@ -89,17 +89,21 @@ jobs:
8989
with:
9090
python-version: 3.11
9191
- name: Test
92-
run:
92+
run: |
93+
brew install urdfdom
9394
export WEBOTS_DISABLE_SAVE_SCREEN_PERSPECTIVE_ON_CLOSE=true
95+
python scripts/packaging/update_urls.py $(git log -1 --format='%H')
9496
export WEBOTS_HOME=/Applications/Webots.app
95-
# we currently can't run the test suite because of https://github.com/cyberbotics/webots/issues/2110
96-
# python tests/test_suite.py
97+
export TESTS_HOME=$PWD # required by cache group in the test suite
98+
export WEBOTS_HOME_PATH=$PWD # required for tests to find Makefile.include
99+
export BRANCH_HASH=$(git log -1 --format='%H')
100+
python tests/test_suite.py
97101
delete-artifacts:
98102
needs: [build, test-suite]
99103
if: ${{ always() && !contains(github.event.pull_request.labels.*.name, 'test distribution') && !contains(github.event.pull_request.labels.*.name, 'test webots build') }}
100104
strategy:
101105
matrix:
102-
os: [macos-14]
106+
os: [macos-13]
103107
runs-on: ubuntu-latest
104108
steps:
105109
- name: Delete artifacts

src/webots/gui/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,12 @@ int main(int argc, char *argv[]) {
147147
#endif
148148
);
149149

150-
// load qt warning filters from file
150+
#ifdef __APPLE__
151+
QString qtFiltersFilePath = QDir::fromNativeSeparators(webotsDirPath + "/Contents/Resources/qt_warning_filters.conf");
152+
#else
151153
QString qtFiltersFilePath = QDir::fromNativeSeparators(webotsDirPath + "/resources/qt_warning_filters.conf");
154+
#endif
155+
// load qt warning filters from file
152156
QFile qtFiltersFile(qtFiltersFilePath);
153157
if (qtFiltersFile.open(QIODevice::ReadOnly)) {
154158
QTextStream in(&qtFiltersFile);

tests/default/controllers/test_suite_supervisor/test_suite_supervisor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ def run(self):
240240

241241
# 30 seconds before executing the next world, 60 seconds for the robot_window_html test
242242
delay = 60 if self.currentSimulationFilename.endswith('/robot_window_html.wbt') else 30
243+
if sys.platform == "darwin":
244+
# Longer timeout on MacOS because Webots takes longer to start there during CI.
245+
delay *= 10
243246
timeout = time.time() + delay
244247

245248
running_controllers_pid = []

tests/physics/controllers/determinism/determinism.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ int main(int argc, char **argv) {
2828

2929
if (file_exists(ode_tmp_dif)) {
3030
double delta = difftime(now, file_get_creation_time(ode_tmp_dif));
31-
// printf("delta time = %f\n", delta);
32-
if (delta > 2.0) {
31+
// printf("%s is %f seconds old.\n", ode_tmp_dif, delta);
32+
if (delta > 20.0) {
3333
ts_assert_boolean_equal(remove_file(ode_tmp_dif), "Cannot remove ODE tmp dif file");
3434
ts_assert_boolean_not_equal(file_exists(ode_tmp_dif), "Cannot remove ODE tmp dif file");
3535
}
@@ -60,7 +60,7 @@ int main(int argc, char **argv) {
6060
exit(EXIT_FAILURE);
6161
}
6262
} else {
63-
move_file(ode_dif, ode_tmp_dif);
63+
ts_assert_boolean_equal(move_file(ode_dif, ode_tmp_dif), "Cannot move ODF dif file to ODE tmp dif file");
6464
wb_supervisor_world_reload();
6565
wb_robot_cleanup();
6666
exit(EXIT_SUCCESS);

tests/test_suite.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def setupWebots():
8686

8787
if sys.platform == 'win32':
8888
webotsFullPath = os.path.join(os.path.normpath(os.environ['WEBOTS_HOME']), 'msys64', 'mingw64', 'bin', 'webots.exe')
89+
elif sys.platform == 'darwin':
90+
webotsFullPath = os.path.join(os.path.normpath(os.environ['WEBOTS_HOME']), 'Contents', 'MacOS', 'webots')
8991
else:
9092
webotsBinary = 'webots'
9193
if 'WEBOTS_HOME' in os.environ:
@@ -198,12 +200,14 @@ def generateWorldsList(groupName):
198200
for filename in filenames:
199201
# speaker test not working on github action because of missing sound drivers
200202
# robot window and movie recording test not working on BETA Ubuntu 22.04 GitHub Action environment
203+
# billboard test not working in macos GitHub Action environment
201204
if (not filename.endswith('_temp.wbt') and
202205
not ('GITHUB_ACTIONS' in os.environ and (
203206
filename.endswith('speaker.wbt') or
204207
filename.endswith('local_proto_with_texture.wbt') or
205208
(filename.endswith('robot_window_html.wbt') and is_ubuntu_22_04) or
206-
(filename.endswith('supervisor_start_stop_movie.wbt') and is_ubuntu_22_04)
209+
(filename.endswith('supervisor_start_stop_movie.wbt') and is_ubuntu_22_04) or
210+
(filename.endswith('billboard.wbt') and sys.platform == 'darwin')
207211
))):
208212
worldsList.append(filename)
209213

@@ -244,7 +248,11 @@ def runGroupTest(groupName, firstSimulation, worldsCount, failures):
244248
command = Command(webotsArguments)
245249

246250
# redirect stdout and stderr to files
247-
command.runTest(timeout=10 * 60) # 10 minutes
251+
timeoutMinutes = 10
252+
if sys.platform == "darwin":
253+
# Longer timeout on MacOS because Webots takes longer to start there during CI.
254+
timeoutMinutes = 60
255+
command.runTest(timeout=timeoutMinutes * 60)
248256

249257
if command.isTimeout or command.returncode != 0:
250258
if command.isTimeout:

0 commit comments

Comments
 (0)