Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions mod_ci/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,8 +1140,9 @@ def update_build_badge(status, test) -> None:
for category_results in test_results:
test_ids_to_update.extend([test['test'].id for test in category_results['tests'] if not test['error']])

g.db.query(RegressionTest).filter(RegressionTest.id.in_(test_ids_to_update)
).update({"last_passed_on": test.id}, synchronize_session=False)
g.db.query(RegressionTest).filter(RegressionTest.id.in_(test_ids_to_update)).update(
{f"last_passed_on_{test.platform.value}": test.id}, synchronize_session=False
)
g.db.commit()


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

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

category_test_pass_count = 0
for test in category_results['tests']:
if not test['error']:
category_test_pass_count += 1
if test['test'].last_passed_on != last_test_master.id:
if last_test_master and getattr(test['test'], platform_column) != last_test_master.id:
fixed_tests.append(test['test'])
else:
if test['test'].last_passed_on != last_test_master.id:
if last_test_master and getattr(test['test'], platform_column) != last_test_master.id:
common_failed_tests.append(test['test'])
else:
extra_failed_tests.append(test['test'])
Expand Down
3 changes: 2 additions & 1 deletion mod_regression/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ class RegressionTest(Base):
output_files = relationship('RegressionTestOutput', back_populates='regression_test')
expected_rc = Column(Integer)
active = Column(Boolean(), default=True)
last_passed_on = Column(Integer, ForeignKey('test.id', onupdate="CASCADE", ondelete="SET NULL"))
last_passed_on_windows = Column(Integer, ForeignKey('test.id', onupdate="CASCADE", ondelete="SET NULL"))
last_passed_on_linux = Column(Integer, ForeignKey('test.id', onupdate="CASCADE", ondelete="SET NULL"))
description = Column(String(length=1024))

def __init__(self, sample_id, command, input_type, output_type, category_id, expected_rc,
Expand Down
9 changes: 8 additions & 1 deletion templates/ci/pr_comment.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
<ul>
{% for test in comment_info.common_failed_tests %}
<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>
<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:
{% set last_passed_id = test.last_passed_on_windows if platform.lower() == 'windows' else test.last_passed_on_linux %}
{% if last_passed_id %}
<a href="{{ url_for('test.by_id', test_id=last_passed_id, _external=True) }}">Test {{ last_passed_id }}</a>
{% else %}
<span>Never</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ci/test_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MockPlatform:

def __init__(self, platform):
self.platform = platform
self.value = 'platform'
self.value = 'linux'


class MockFork:
Expand Down
Loading