Skip to content

Commit 6d057a0

Browse files
committed
feat: add per platform last passed tracking
1 parent b124887 commit 6d057a0

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

mod_ci/controllers.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,8 +1140,9 @@ def update_build_badge(status, test) -> None:
11401140
for category_results in test_results:
11411141
test_ids_to_update.extend([test['test'].id for test in category_results['tests'] if not test['error']])
11421142

1143-
g.db.query(RegressionTest).filter(RegressionTest.id.in_(test_ids_to_update)
1144-
).update({"last_passed_on": test.id}, synchronize_session=False)
1143+
g.db.query(RegressionTest).filter(RegressionTest.id.in_(test_ids_to_update)).update(
1144+
{f"last_passed_on_{test.platform.value}": test.id}, synchronize_session=False
1145+
)
11451146
g.db.commit()
11461147

11471148

@@ -1576,17 +1577,18 @@ def get_info_for_pr_comment(test: Test) -> PrCommentInfo:
15761577
category_stats = []
15771578

15781579
test_results = get_test_results(test)
1580+
platform_column = f"last_passed_on_{test.platform.value}"
15791581
for category_results in test_results:
15801582
category_name = category_results['category'].name
15811583

15821584
category_test_pass_count = 0
15831585
for test in category_results['tests']:
15841586
if not test['error']:
15851587
category_test_pass_count += 1
1586-
if test['test'].last_passed_on != last_test_master.id:
1588+
if getattr(test['test'], platform_column) != last_test_master.id:
15871589
fixed_tests.append(test['test'])
15881590
else:
1589-
if test['test'].last_passed_on != last_test_master.id:
1591+
if getattr(test['test'], platform_column) != last_test_master.id:
15901592
common_failed_tests.append(test['test'])
15911593
else:
15921594
extra_failed_tests.append(test['test'])

mod_regression/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ class RegressionTest(Base):
9494
output_files = relationship('RegressionTestOutput', back_populates='regression_test')
9595
expected_rc = Column(Integer)
9696
active = Column(Boolean(), default=True)
97-
last_passed_on = Column(Integer, ForeignKey('test.id', onupdate="CASCADE", ondelete="SET NULL"))
97+
last_passed_on_windows = Column(Integer, ForeignKey('test.id', onupdate="CASCADE", ondelete="SET NULL"))
98+
last_passed_on_linux = Column(Integer, ForeignKey('test.id', onupdate="CASCADE", ondelete="SET NULL"))
9899
description = Column(String(length=1024))
99100

100101
def __init__(self, sample_id, command, input_type, output_type, category_id, expected_rc,

templates/ci/pr_comment.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@ Your PR breaks these cases:
3030
NOTE: The following tests have been failing on the master branch as well as the PR:
3131
<ul>
3232
{% for test in comment_info.common_failed_tests %}
33-
<li> ccextractor {{ test.command }} <a href="{{ url_for('sample.sample_by_id', sample_id=test.sample.id, _external=True) }}">{{ test.sample.sha[:10] }}...</a>, Last passed: {% if test.last_passed_on %}<a href="{{ url_for('test.by_id', test_id=test.last_passed_on, _external=True) }}">Test {{ test.last_passed_on }}</a>{% else %}<span>Never</span>{% endif %}</li>
33+
<li> ccextractor {{ test.command }} <a href="{{ url_for('sample.sample_by_id', sample_id=test.sample.id, _external=True) }}">{{ test.sample.sha[:10] }}...</a>, Last passed:
34+
{% set last_passed_id = test.last_passed_on_windows if platform.lower() == 'windows' else test.last_passed_on_linux %}
35+
{% if last_passed_id %}
36+
<a href="{{ url_for('test.by_id', test_id=last_passed_id, _external=True) }}">Test {{ last_passed_id }}</a>
37+
{% else %}
38+
<span>Never</span>
39+
{% endif %}
40+
</li>
3441
{% endfor %}
3542
</ul>
3643
{% endif %}

0 commit comments

Comments
 (0)