Skip to content

Commit d5b2c0b

Browse files
committed
miri: Enable tests using epoll_wait
Based on recent segfaults we definitely want more Miri testing.
1 parent 6b760a9 commit d5b2c0b

File tree

39 files changed

+88
-81
lines changed

39 files changed

+88
-81
lines changed

.config/nextest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
slow-timeout = { period = "60s", terminate-after = 2 }
33

44
[profile.default-miri]
5-
slow-timeout = { period = "600s", terminate-after = 2 }
5+
slow-timeout = { period = "1200s", terminate-after = 2 }
66

77
# For a given configuration parameter, the first override to match wins. Keep
88
# these sorted in order from most specific to least specific.

bin/ci-builder

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ case "$cmd" in
180180
--env NIGHTLY_CANARY_CONFLUENT_CLOUD_API_SECRET
181181
--env NO_COLOR
182182
--env PYPI_TOKEN
183+
--env ZOOKEEPER_ADDR
184+
--env KAFKA_ADDRS
185+
--env SCHEMA_REGISTRY_URL
186+
--env POSTGRES_URL
187+
--env COCKROACH_URL
188+
--env MZ_SOFT_ASSERTIONS
189+
--env MZ_PERSIST_EXTERNAL_STORAGE_TEST_S3_BUCKET
190+
--env MZ_PERSIST_EXTERNAL_STORAGE_TEST_POSTGRES_URL
183191
)
184192

185193
if [[ $detach_container == "true" ]]; then

ci/test/cargo-test-miri.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ set -euo pipefail
1818
# so keep them away from the `target` directory.
1919
export CARGO_TARGET_DIR="$PWD/miri-target"
2020
export MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-strict-provenance"
21-
# exclude netwrok based tests, they mostly fail on epoll_wait
22-
cargo miri nextest run -j"$(nproc)" --no-fail-fast --workspace --exclude 'mz-adapter*' --exclude 'mz-environmentd*' --exclude 'mz-expr*' --exclude 'mz-compute-client*' --exclude 'mz-persist-client*' --exclude 'mz-ssh-util*' --exclude 'mz-rocksdb*'
21+
# exclude network-based and more complex tests which run out of memory
22+
cargo miri nextest run -j"$(nproc)" --no-fail-fast --workspace --exclude 'mz-environmentd*' --exclude 'mz-compute-client*' --exclude 'mz-ssh-util*' --exclude 'mz-rocksdb*'

ci/test/cargo-test/mzcompose.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939

4040
def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
41+
parser.add_argument("--miri", action="store_true")
4142
parser.add_argument("args", nargs="*")
4243
args = parser.parse_args()
4344
c.up("zookeeper", "kafka", "schema-registry", "postgres", "cockroach")
@@ -116,17 +117,23 @@ def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
116117
],
117118
env=env,
118119
)
119-
cpu_count = os.cpu_count()
120-
assert cpu_count
121-
spawn.runv(
122-
[
123-
"cargo",
124-
"nextest",
125-
"run",
126-
"--profile=ci",
127-
# Most tests don't use 100% of a CPU core, so run two tests per CPU.
128-
f"--test-threads={cpu_count * 2}",
129-
*args.args,
130-
],
131-
env=env,
132-
)
120+
if args.miri:
121+
spawn.runv(
122+
["bin/ci-builder", "run", "nightly", "ci/test/cargo-test-miri.sh"],
123+
env=env,
124+
)
125+
else:
126+
cpu_count = os.cpu_count()
127+
assert cpu_count
128+
spawn.runv(
129+
[
130+
"cargo",
131+
"nextest",
132+
"run",
133+
"--profile=ci",
134+
# Most tests don't use 100% of a CPU core, so run two tests per CPU.
135+
f"--test-threads={cpu_count * 2}",
136+
*args.args,
137+
],
138+
env=env,
139+
)

ci/test/pipeline.template.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,24 @@ steps:
155155

156156
- id: miri-test
157157
label: Miri test
158-
command: bin/ci-builder run nightly ci/test/cargo-test-miri.sh
159158
inputs: [src]
160-
timeout_in_minutes: 30
159+
timeout_in_minutes: 60
160+
artifact_paths: [junit_*.xml, target/nextest/ci/junit_cargo-test.xml]
161+
inputs:
162+
- Cargo.lock
163+
- "**/Cargo.toml"
164+
- "**/*.rs"
165+
- "**/*.proto"
166+
- "**/testdata/**"
167+
env:
168+
AWS_DEFAULT_REGION: "us-east-1"
169+
# cargo-test's coverage is handled separately by cargo-llvm-cov
170+
BUILDKITE_MZCOMPOSE_PLUGIN_SKIP_COVERAGE: "true"
171+
plugins:
172+
- ./ci/plugins/scratch-aws-access: ~
173+
- ./ci/plugins/mzcompose:
174+
composition: cargo-test
175+
args: [--miri]
161176
agents:
162177
queue: builder-linux-x86_64
163178
coverage: skip

src/adapter/src/catalog.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8399,6 +8399,7 @@ mod tests {
83998399
/// search paths, so do not require schema qualification on system objects such
84008400
/// as types.
84018401
#[mz_ore::test(tokio::test)]
8402+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
84028403
async fn test_minimal_qualification() {
84038404
Catalog::with_debug(NOW_ZERO.clone(), |catalog| async move {
84048405
struct TestCase {
@@ -8471,6 +8472,7 @@ mod tests {
84718472
}
84728473

84738474
#[mz_ore::test(tokio::test)]
8475+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
84748476
async fn test_catalog_revision() {
84758477
let debug_stash_factory = DebugStashFactory::new().await;
84768478
{
@@ -8506,6 +8508,7 @@ mod tests {
85068508
}
85078509

85088510
#[mz_ore::test(tokio::test)]
8511+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
85098512
async fn test_effective_search_path() {
85108513
Catalog::with_debug(NOW_ZERO.clone(), |catalog| async move {
85118514
let mz_catalog_schema = (
@@ -8651,6 +8654,7 @@ mod tests {
86518654
}
86528655

86538656
#[mz_ore::test(tokio::test)]
8657+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
86548658
async fn test_builtin_migration() {
86558659
enum ItemNamespace {
86568660
System,
@@ -9305,6 +9309,7 @@ mod tests {
93059309
}
93069310

93079311
#[mz_ore::test(tokio::test)]
9312+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
93089313
async fn test_normalized_create() {
93099314
Catalog::with_debug(NOW_ZERO.clone(), |catalog| {
93109315
let catalog = catalog.for_system_session();
@@ -9489,6 +9494,7 @@ mod tests {
94899494
}
94909495

94919496
#[mz_ore::test(tokio::test)]
9497+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
94929498
async fn test_object_type() {
94939499
let debug_stash_factory = DebugStashFactory::new().await;
94949500
let stash = debug_stash_factory.open_debug().await;
@@ -9508,6 +9514,7 @@ mod tests {
95089514
}
95099515

95109516
#[mz_ore::test(tokio::test)]
9517+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
95119518
async fn test_get_privileges() {
95129519
let debug_stash_factory = DebugStashFactory::new().await;
95139520
let stash = debug_stash_factory.open_debug().await;

src/adapter/src/catalog/builtin.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4185,6 +4185,7 @@ mod tests {
41854185
// Connect to a running Postgres server and verify that our builtin
41864186
// types and functions match it, in addition to some other things.
41874187
#[mz_ore::test(tokio::test)]
4188+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
41884189
async fn test_compare_builtins_postgres() {
41894190
async fn inner(catalog: Catalog) {
41904191
// Verify that all builtin functions:
@@ -4511,6 +4512,7 @@ mod tests {
45114512

45124513
// Make sure pg views don't use types that only exist in Materialize.
45134514
#[mz_ore::test(tokio::test)]
4515+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
45144516
async fn test_pg_views_forbidden_types() {
45154517
Catalog::with_debug(SYSTEM_TIME.clone(), |catalog| async move {
45164518
let conn_catalog = catalog.for_system_session();

src/adapter/src/config/params.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ mod tests {
146146
use super::SynchronizedParameters;
147147

148148
#[mz_ore::test]
149+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `decNumberFromInt32` on OS `linux`
149150
fn test_github_18189() {
150151
let vars = SystemVars::default();
151152
let mut sync = SynchronizedParameters::new(vars);
@@ -156,6 +157,7 @@ mod tests {
156157
}
157158

158159
#[mz_ore::test]
160+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `decNumberFromInt32` on OS `linux`
159161
fn test_vars_are_synced() {
160162
let vars = SystemVars::default();
161163
let sync = SynchronizedParameters::new(vars);

src/adapter/src/coord/peek.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ mod tests {
584584
use super::*;
585585

586586
#[mz_ore::test]
587+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `rust_psm_stack_pointer` on OS `linux`
587588
fn test_fast_path_plan_as_text() {
588589
let typ = RelationType::new(vec![ColumnType {
589590
scalar_type: ScalarType::String,

src/adapter/tests/parameters.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ use mz_repr::ScalarType;
8080
use mz_sql::plan::PlanContext;
8181

8282
#[mz_ore::test(tokio::test)]
83+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
8384
async fn test_parameter_type_inference() {
8485
let test_cases = vec![
8586
(

src/adapter/tests/sql.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ use tokio::sync::Mutex;
102102
// catalog.
103103

104104
#[mz_ore::test(tokio::test)]
105+
#[cfg_attr(miri, ignore)] // error: unsupported operation: can't call foreign function `TLS_client_method` on OS `linux`
105106
async fn datadriven() {
106107
datadriven::walk_async("tests/testdata/sql", |mut f| async {
107108
// The datadriven API takes an `FnMut` closure, and can't express to Rust that

src/adapter/tests/timestamp_selection.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ fn parse_query_when(s: &str) -> QueryWhen {
261261
/// returns the chosen timestamp. Append `full` as an argument to it to see the entire
262262
/// TimestampDetermination.
263263
#[mz_ore::test]
264+
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `decNumberFromInt32` on OS `linux`
264265
fn test_timestamp_selection() {
265266
datadriven::walk("tests/testdata/timestamp_selection", |tf| {
266267
let mut f = Frontiers {

src/compute-client/src/plan/join/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ mod tests {
421421
#![proptest_config(ProptestConfig::with_cases(32))]
422422

423423
#[mz_ore::test]
424+
#[cfg_attr(miri, ignore)] // error: unsupported operation: can't call foreign function `decContextDefault` on OS `linux`
424425
fn join_plan_protobuf_roundtrip(expect in any::<JoinPlan>() ) {
425426
let actual = protobuf_roundtrip::<_, ProtoJoinPlan>(&expect);
426427
assert!(actual.is_ok());

src/compute-client/src/plan/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,6 +2197,7 @@ mod tests {
21972197
proptest! {
21982198
#![proptest_config(ProptestConfig::with_cases(10))]
21992199
#[mz_ore::test]
2200+
#[cfg_attr(miri, ignore)] // error: unsupported operation: can't call foreign function `decContextDefault` on OS `linux`
22002201
fn get_plan_protobuf_roundtrip(expect in any::<GetPlan>()) {
22012202
let actual = protobuf_roundtrip::<_, ProtoGetPlan>(&expect);
22022203
assert!(actual.is_ok());

src/compute-client/src/protocol/command.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ mod tests {
512512
#![proptest_config(ProptestConfig::with_cases(32))]
513513

514514
#[mz_ore::test]
515+
#[cfg_attr(miri, ignore)] // error: unsupported operation: can't call foreign function `decContextDefault` on OS `linux`
515516
fn peek_protobuf_roundtrip(expect in any::<Peek>() ) {
516517
let actual = protobuf_roundtrip::<_, ProtoPeek>(&expect);
517518
assert!(actual.is_ok());

src/environmentd/tests/pgwire.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ fn test_bind_params() {
171171
}
172172

173173
#[mz_ore::test]
174-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `epoll_wait` on OS `linux`
175174
fn test_partial_read() {
176175
let server = util::start_server(util::Config::default()).unwrap();
177176
let mut client = server.connect(postgres::NoTls).unwrap();
@@ -198,7 +197,6 @@ fn test_partial_read() {
198197
}
199198

200199
#[mz_ore::test]
201-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `epoll_wait` on OS `linux`
202200
fn test_read_many_rows() {
203201
let server = util::start_server(util::Config::default()).unwrap();
204202
let mut client = server.connect(postgres::NoTls).unwrap();
@@ -213,7 +211,6 @@ fn test_read_many_rows() {
213211
}
214212

215213
#[mz_ore::test]
216-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `epoll_wait` on OS `linux`
217214
fn test_conn_startup() {
218215
let server = util::start_server(util::Config::default()).unwrap();
219216
let mut client = server.connect(postgres::NoTls).unwrap();
@@ -362,7 +359,6 @@ fn test_conn_startup() {
362359
}
363360

364361
#[mz_ore::test]
365-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `epoll_wait` on OS `linux`
366362
fn test_conn_user() {
367363
let server = util::start_server(util::Config::default()).unwrap();
368364

@@ -397,7 +393,6 @@ fn test_conn_user() {
397393
}
398394

399395
#[mz_ore::test]
400-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `epoll_wait` on OS `linux`
401396
fn test_simple_query_no_hang() {
402397
let server = util::start_server(util::Config::default()).unwrap();
403398
let mut client = server.connect(postgres::NoTls).unwrap();
@@ -407,7 +402,6 @@ fn test_simple_query_no_hang() {
407402
}
408403

409404
#[mz_ore::test]
410-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `epoll_wait` on OS `linux`
411405
fn test_copy() {
412406
let server = util::start_server(util::Config::default()).unwrap();
413407
let mut client = server.connect(postgres::NoTls).unwrap();
@@ -457,7 +451,6 @@ fn test_copy() {
457451
}
458452

459453
#[mz_ore::test]
460-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `epoll_wait` on OS `linux`
461454
fn test_arrays() {
462455
let server = util::start_server(util::Config::default().unsafe_mode()).unwrap();
463456
let mut client = server.connect(postgres::NoTls).unwrap();
@@ -505,7 +498,6 @@ fn test_arrays() {
505498
}
506499

507500
#[mz_ore::test]
508-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `epoll_wait` on OS `linux`
509501
fn test_record_types() {
510502
let server = util::start_server(util::Config::default()).unwrap();
511503
let mut client = server.connect(postgres::NoTls).unwrap();
@@ -573,15 +565,12 @@ fn pg_test_inner(dir: PathBuf, flags: &[&'static str]) {
573565
}
574566

575567
#[mz_ore::test]
576-
#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `epoll_wait` on OS `linux`
577568
fn test_pgtest() {
578569
let dir: PathBuf = ["..", "..", "test", "pgtest"].iter().collect();
579570
pg_test_inner(dir, &[]);
580571
}
581572

582573
#[mz_ore::test]
583-
// unsupported operation: can't call foreign function `epoll_wait` on OS `linux`
584-
#[cfg_attr(miri, ignore)]
585574
// Materialize's differences from Postgres' responses.
586575
fn test_pgtest_mz() {
587576
let dir: PathBuf = ["..", "..", "test", "pgtest-mz"].iter().collect();

0 commit comments

Comments
 (0)