Repository navigation
139 lines (132 loc) · 5.26 KB
/
Copy pathjitter.yml
File metadata and controls
139 lines (132 loc) · 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: jitter
# THE SEARCH FOR AN ORDER DEFECT (design 2026-11-20 §5.19, SPEC-017 O12). A case whose verdict
# depends on an order nothing fixes passes most of the time; jitter makes the other orders likely:
# each program waits a random time, up to the jitter, at its contention points -- mtest's at a
# case's start and at a shared object, mcpp's where it takes a lock and where it publishes. A run
# with jitter is a search, never a verdict of the tree: it runs on main's tree, apart from the pull
# requests' runs and the full verification.
#
# weekly every unit and C++ e2e case of Linux, three seeds.
# a flip a CI run of main ended with a case whose verdict changed within it (failed, then
# passed when its shard ran again, or `flaky`): that case alone, five seeds.
# by hand the cases, the jitter and the seeds given.
#
# The summary names each seed's result: a seed that fails repeats the order with
# `MTEST_JITTER=<ms> MTEST_JITTER_SEED=<seed> mcpp test --case <case>`.
on:
schedule:
- cron: "41 3 * * 6"
workflow_run:
workflows: [ci]
types: [completed]
branches: [main]
workflow_dispatch:
inputs:
cases:
description: the cases, one `mcpp test --case` pattern per line; empty for every case
type: string
default: ''
jitter:
description: the most a contention point waits, in milliseconds
type: string
default: '50'
seeds:
description: the seeds, a JSON list
type: string
default: '[1, 2, 3]'
permissions:
contents: read
actions: read
jobs:
# The cases whose verdict changed within the CI run that triggered this one, from its stores:
# a case with both a failure and a pass in the run's group, or one recorded `flaky`.
plan:
name: what the jitter runs
runs-on: ubuntu-24.04
timeout-minutes: 10
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion != 'cancelled' }}
outputs:
cases: ${{ steps.plan.outputs.cases }}
seeds: ${{ steps.plan.outputs.seeds }}
jitter: ${{ steps.plan.outputs.jitter }}
run: ${{ steps.plan.outputs.run }}
steps:
- uses: actions/checkout@v4
- name: The cases, the seeds and the jitter
id: plan
env:
GH_TOKEN: ${{ github.token }}
EVENT: ${{ github.event_name }}
RUN: ${{ github.event.workflow_run.id }}
CASES: ${{ inputs.cases }}
JITTER: ${{ inputs.jitter }}
SEEDS: ${{ inputs.seeds }}
run: |
set -euo pipefail
case "$EVENT" in
workflow_dispatch)
{ echo "cases<<EOF"; echo "$CASES"; echo "EOF"; } >> "$GITHUB_OUTPUT"
echo "seeds=$SEEDS" >> "$GITHUB_OUTPUT"; echo "jitter=$JITTER" >> "$GITHUB_OUTPUT"
echo "run=true" >> "$GITHUB_OUTPUT" ;;
schedule)
{ echo "cases<<EOF"; echo; echo "EOF"; } >> "$GITHUB_OUTPUT"
echo "seeds=[1, 2, 3]" >> "$GITHUB_OUTPUT"; echo "jitter=50" >> "$GITHUB_OUTPUT"
echo "run=true" >> "$GITHUB_OUTPUT" ;;
workflow_run)
mkdir -p stores
gh run download "$RUN" -R "$GITHUB_REPOSITORY" -p 'mtest-unit-*' -D stores 2>/dev/null || true
# `<program>/<case>` -> every status the run's attempts recorded.
flips=$(find stores -name cases.ndjson -print0 | xargs -0 -r cat \
| jq -rs 'group_by(.program + "\u0000" + .id)
| map(select((map(.status) | (index("fail") != null and index("pass") != null))
or (map(.status) | index("flaky") != null)))
| .[] | .[0].id' | sort -u)
{ echo "cases<<EOF"; echo "$flips"; echo "EOF"; } >> "$GITHUB_OUTPUT"
echo "seeds=[1, 2, 3, 4, 5]" >> "$GITHUB_OUTPUT"; echo "jitter=50" >> "$GITHUB_OUTPUT"
if [ -n "$flips" ]; then echo "run=true" >> "$GITHUB_OUTPUT"; else echo "run=false" >> "$GITHUB_OUTPUT"; fi
echo "the cases whose verdict changed in run $RUN:"; echo "${flips:-(none)}" ;;
esac
build-linux:
needs: plan
if: ${{ needs.plan.outputs.run == 'true' }}
permissions:
contents: read
actions: write
uses: ./.github/workflows/build.yml
with:
host: linux-x86_64
runs-on: ubuntu-24.04
gate: ''
unit-archive:
needs: plan
if: ${{ needs.plan.outputs.run == 'true' }}
permissions:
contents: read
actions: read
uses: ./.github/workflows/ci-unit.yml
with:
stage: archive
host: linux-x86_64
name: linux-jitter
runs-on: ubuntu-24.04
# One run per seed, each a shard of its own over the selected cases.
unit:
needs: [plan, build-linux, unit-archive]
strategy:
fail-fast: false
matrix:
seed: ${{ fromJSON(needs.plan.outputs.seeds) }}
permissions:
contents: read
actions: write
uses: ./.github/workflows/ci-unit.yml
with:
stage: run
host: linux-x86_64
name: linux-jitter-${{ matrix.seed }}
runs-on: ubuntu-24.04
archived: ${{ needs.unit-archive.outputs.archived }}
gate: ''
select: ${{ needs.plan.outputs.cases }}
jitter: ${{ needs.plan.outputs.jitter }}
jitter-seed: ${{ matrix.seed }}