Skip to content

Commit 91a2f80

Browse files
authored
Merge pull request #518 from ehuss/fix-macos-ci
Fix macOS install issue
2 parents aba5b4e + 336da14 commit 91a2f80

File tree

3 files changed

+47
-15
lines changed

3 files changed

+47
-15
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v1
2626
- run: bash ci/install-rust.sh ${{ matrix.rust }}
27+
# Temporary workaround until Package Control 4 works
28+
# https://github.com/wbond/package_control/issues/1612
29+
- name: Fix macOS OpenSSL
30+
if: matrix.os == 'macos-latest'
31+
run: brew unlink openssl
2732
- uses: SublimeText/UnitTesting/actions/setup@v1
2833
with:
2934
package-name: Rust Enhanced

rust/opanel.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
# this would be a problem. If it is, it's a simple matter of changing this.
1212
PANEL_NAME = 'exec'
1313

14+
# Pattern used for finding location of panics in test output.
15+
#
16+
# Rust 1.73 changed the formatting of a panic message.
17+
# Older versions looked like:
18+
# thread 'basic_error1' panicked at 'assertion failed: false', tests/test_test_output.rs:9:5
19+
# 1.73 changed it to look like:
20+
# thread 'basic_error1' panicked at tests/test_test_output.rs:9:5:
21+
# assertion failed: false
22+
PANIC_PATTERN = r'(?:, |panicked at )([^,<\n]*\.[A-z]{2}):([0-9]+)'
1423

1524
def create_output_panel(window, base_dir):
1625
output_view = window.create_output_panel(PANEL_NAME)
@@ -21,8 +30,7 @@ def create_output_panel(window, base_dir):
2130
s.set('result_file_regex', '^[^:]+: (..[^:]*):([0-9]+): (.*)$')
2231
else:
2332
build_pattern = '^[ \\t]*-->[ \\t]*([^<\n]*):([0-9]+):([0-9]+)'
24-
test_pattern = ', ([^,<\n]*\\.[A-z]{2}):([0-9]+)'
25-
pattern = '(?|%s|%s)' % (build_pattern, test_pattern)
33+
pattern = '(?|%s|%s)' % (build_pattern, PANIC_PATTERN)
2634
s.set('result_file_regex', pattern)
2735
# Used for resolving relative paths.
2836
s.set('result_base_dir', base_dir)
@@ -76,8 +84,9 @@ def on_data(self, proc, data):
7684
# Re-fetch the data to handle things like \t expansion.
7785
appended = self.output_view.substr(
7886
sublime.Region(region_start, self.output_view.size()))
79-
m = re.search(r', ([^,<\n]*\.[A-z]{2}):([0-9]+):([0-9]+)',
80-
appended)
87+
# This pattern also includes column numbers (which Sublime's
88+
# result_file_regex doesn't support).
89+
m = re.search(PANIC_PATTERN + r':([0-9]+)', appended)
8190
if m:
8291
path = os.path.join(self.base_path, m.group(1))
8392
if not os.path.exists(path):

tests/test_message_order.py

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ def _test_message_order(self, view, messages, inline, command):
106106

107107
to_close = []
108108

109+
# Helper to check when the view is updated to the correct location.
110+
def check_view_has_updated(window, expected_filename, expected_row_col):
111+
view = window.active_view()
112+
view_filename = os.path.normpath(view.file_name())
113+
if view_filename != expected_filename:
114+
return False
115+
region = view.sel()[0]
116+
rowcol = view.rowcol(region.begin())
117+
if expected_row_col[1] is None:
118+
return rowcol[0] == expected_row_col[0]
119+
else:
120+
return rowcol == expected_row_col
121+
109122
def check_sequence(direction):
110123
omsgs = messages if direction == 'next' else reversed(messages)
111124
levels = ('all', 'error', 'warning') if inline else ('all',)
@@ -124,22 +137,27 @@ def check_sequence(direction):
124137
window.run_command('rust_' + direction + '_message',
125138
{'levels': level})
126139
# Sublime doesn't always immediately move the active
127-
# view when 'next_result' is called, so give it a
128-
# moment to update.
129-
time.sleep(0.1)
130-
next_view = window.active_view()
131-
to_close.append(next_view)
132-
self.assertEqual(os.path.normpath(next_view.file_name()),
133-
os.path.normpath(next_filename))
134-
region = next_view.sel()[0]
135-
rowcol = next_view.rowcol(region.begin())
140+
# view when 'next_result' is called, so loop until
141+
# it looks like it has updated to the correct location.
142+
expected_filename = os.path.normpath(next_filename)
136143
if inline:
137-
self.assertEqual(rowcol, next_row_col)
144+
expected_row_col = next_row_col
138145
else:
139146
# When inline is disabled, we use Sublime's
140147
# built-in next/prev, which goes to the beginning.
141148
# Just validate the row is correct.
142-
self.assertEqual(rowcol[0], next_row_col[0])
149+
expected_row_col = (next_row_col[0], None)
150+
for _ in range(30):
151+
if check_view_has_updated(window, expected_filename, expected_row_col):
152+
break
153+
time.sleep(0.1)
154+
else:
155+
view = window.active_view()
156+
raise AssertionError('view did not update to %r at %r as expected\ncurrent view is %r at %r' % (
157+
expected_filename, expected_row_col,
158+
view.file_name(), view.rowcol(view.sel()[0].begin()))
159+
)
160+
to_close.append(window.active_view())
143161
# Verify the output panel is highlighting the correct
144162
# thing.
145163
build_panel = window.find_output_panel(

0 commit comments

Comments
 (0)