Skip to content
Open
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
9 changes: 5 additions & 4 deletions .github/workflows/kernel-ci-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,16 @@ jobs:
- name: Check out the change
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ needs.plan.outputs.head_sha }}
persist-credentials: false
# Fetch the event's named ref, not raw SHAs: the PR's merge ref contains
# both parents. SHA fetches exhausted this job before compilation.
- name: Fetch history back to the target branch
run: |
git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" "$HEAD_SHA"
for depth in 64 256 1024 4096; do
git merge-base "$BASE_SHA" "$HEAD_SHA" >/dev/null && break
git fetch --quiet --no-tags --depth="$depth" origin "$BASE_SHA" "$HEAD_SHA"
git merge-base "$BASE_SHA" "$HEAD_SHA" >/dev/null 2>&1 && break
git fetch --quiet --no-tags --depth="$depth" origin "$GITHUB_REF"
done
git merge-base "$BASE_SHA" "$HEAD_SHA" >/dev/null
- name: Install LLVM 18
run: |
sudo apt-get update -q
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/tas2764.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,8 +1024,9 @@ static int tas2764_i2c_probe(struct i2c_client *client)
if (client->dev.of_node) {
result = tas2764_parse_dt(&client->dev, tas2764);
if (result) {
dev_err(tas2764->dev, "%s: Failed to parse devicetree\n",
__func__);
if (result != -EPROBE_DEFER)
dev_err(tas2764->dev, "%s: Failed to parse devicetree\n",
__func__);
return result;
}
}
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/tas2770.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,9 @@ static int tas2770_i2c_probe(struct i2c_client *client)
if (client->dev.of_node) {
result = tas2770_parse_dt(&client->dev, tas2770);
if (result) {
dev_err(tas2770->dev, "%s: Failed to parse devicetree\n",
__func__);
if (result != -EPROBE_DEFER)
dev_err(tas2770->dev, "%s: Failed to parse devicetree\n",
__func__);
return result;
}
}
Expand Down
61 changes: 61 additions & 0 deletions tools/aurora-ci/tests/test_compile_fetch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""Exercise the compile workflow's history step without compiling a kernel."""
import os
from pathlib import Path
import re
import subprocess
import tempfile
import unittest


class CompileFetchTests(unittest.TestCase):
def test_named_merge_ref_contains_both_sides_and_missing_head_refuses(self):
workflow = (Path(__file__).resolve().parents[3] / '.github/workflows/kernel-ci-jobs.yml').read_text()
compile_job = workflow.split('\n compile:\n', 1)[1].split('\n devicetree:\n', 1)[0]
checkout = compile_job.split('- name: Fetch history', 1)[0]
self.assertNotIn('ref: ${{ needs.plan.outputs.head_sha }}', checkout)
match = re.search(r'- name: Fetch history[^\n]*\n run: \|\n((?: .*\n)+)', compile_job)
self.assertIsNotNone(match)
assert match is not None
script = match[1]
script = '\n'.join(line[10:] for line in script.splitlines())
self.assertNotIn('origin "$BASE_SHA"', script)
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
source = root / 'source'
source.mkdir()

def git(*args, cwd=source):
return subprocess.check_output(['git', *args], cwd=cwd, text=True, stderr=subprocess.DEVNULL).strip()

git('init', '-q', '-b', 'main')
git('config', 'user.name', 'CI test')
git('config', 'user.email', '[email protected]')
git('config', 'commit.gpgsign', 'false')
git('config', 'core.hooksPath', '/dev/null')
git('commit', '-q', '--allow-empty', '-m', 'common')
git('checkout', '-qb', 'change')
git('commit', '-q', '--allow-empty', '-m', 'change')
head = git('rev-parse', 'HEAD')
git('checkout', '-q', 'main')
git('commit', '-q', '--allow-empty', '-m', 'base')
base = git('rev-parse', 'HEAD')
git('merge', '-q', '--no-ff', 'change', '-m', 'merge')
event_ref = 'refs/pull/166/merge'
git('update-ref', event_ref, 'HEAD')
clone = root / 'clone'
clone.mkdir()
git('init', '-q', cwd=clone)
git('remote', 'add', 'origin', source.as_uri(), cwd=clone)
git('fetch', '-q', '--depth=1', 'origin', event_ref, cwd=clone)
git('checkout', '-q', 'FETCH_HEAD', cwd=clone)
env = dict(os.environ, BASE_SHA=base, HEAD_SHA=head, GITHUB_REF=event_ref)
result = subprocess.run(['bash', '-euo', 'pipefail', '-c', script], cwd=clone, env=env, capture_output=True)
self.assertEqual(result.returncode, 0, result.stderr.decode())
self.assertTrue(git('merge-base', base, head, cwd=clone))
env['HEAD_SHA'] = '0' * 40
result = subprocess.run(['bash', '-euo', 'pipefail', '-c', script], cwd=clone, env=env, capture_output=True)
self.assertNotEqual(result.returncode, 0)


if __name__ == '__main__':
unittest.main()
Loading