From 94d899683907698430c1c095e74a6c55c2406168 Mon Sep 17 00:00:00 2001 From: nkey Date: Mon, 13 Jan 2025 00:51:37 +0100 Subject: [PATCH v1] test: Add isolation test for injection points markers Add a new isolation test case that verifies the behavior of injection points with wait/wakeup operations across multiple sessions. The test ensures proper synchronization when detaching and waking up injection points in different orders. --- src/test/modules/injection_points/Makefile | 2 +- .../injection_points/expected/markers.out | 101 ++++++++++++++++++ src/test/modules/injection_points/meson.build | 1 + .../injection_points/specs/markers.spec | 45 ++++++++ 4 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 src/test/modules/injection_points/expected/markers.out create mode 100644 src/test/modules/injection_points/specs/markers.spec diff --git a/src/test/modules/injection_points/Makefile b/src/test/modules/injection_points/Makefile index 0753a9df58c..4f47f4a0e7e 100644 --- a/src/test/modules/injection_points/Makefile +++ b/src/test/modules/injection_points/Makefile @@ -13,7 +13,7 @@ PGFILEDESC = "injection_points - facility for injection points" REGRESS = injection_points reindex_conc REGRESS_OPTS = --dlpath=$(top_builddir)/src/test/regress -ISOLATION = basic inplace +ISOLATION = basic inplace markers TAP_TESTS = 1 diff --git a/src/test/modules/injection_points/expected/markers.out b/src/test/modules/injection_points/expected/markers.out new file mode 100644 index 00000000000..136bbae8338 --- /dev/null +++ b/src/test/modules/injection_points/expected/markers.out @@ -0,0 +1,101 @@ +Parsed test spec with 3 sessions + +starting permutation: after before detach1 wakeup1 detach2 wakeup2 +injection_points_attach +----------------------- + +(1 row) + +injection_points_attach +----------------------- + +(1 row) + +step after: SELECT injection_points_run('injection-points-wait-1'); +step before: SELECT injection_points_run('injection-points-wait-2'); +step detach1: SELECT injection_points_detach('injection-points-wait-1'); +injection_points_detach +----------------------- + +(1 row) + +step wakeup1: SELECT injection_points_wakeup('injection-points-wait-1'); +injection_points_wakeup +----------------------- + +(1 row) + +step detach2: SELECT injection_points_detach('injection-points-wait-2'); +injection_points_detach +----------------------- + +(1 row) + +step wakeup2: SELECT injection_points_wakeup('injection-points-wait-2'); +injection_points_wakeup +----------------------- + +(1 row) + +step before: <... completed> +injection_points_run +-------------------- + +(1 row) + +step after: <... completed> +injection_points_run +-------------------- + +(1 row) + + +starting permutation: after wakeup1 before detach1 detach2 wakeup2 +injection_points_attach +----------------------- + +(1 row) + +injection_points_attach +----------------------- + +(1 row) + +step after: SELECT injection_points_run('injection-points-wait-1'); +step wakeup1: SELECT injection_points_wakeup('injection-points-wait-1'); +injection_points_wakeup +----------------------- + +(1 row) + +step before: SELECT injection_points_run('injection-points-wait-2'); +step detach1: SELECT injection_points_detach('injection-points-wait-1'); +injection_points_detach +----------------------- + +(1 row) + +step detach2: SELECT injection_points_detach('injection-points-wait-2'); +injection_points_detach +----------------------- + +(1 row) + +step wakeup2: SELECT injection_points_wakeup('injection-points-wait-2'); +injection_points_wakeup +----------------------- + +(1 row) + +step before: <... completed> +injection_points_run +-------------------- + +(1 row) + +step after: <... completed> +injection_points_run +-------------------- + +(1 row) + diff --git a/src/test/modules/injection_points/meson.build b/src/test/modules/injection_points/meson.build index 989b4db226b..3998bac852f 100644 --- a/src/test/modules/injection_points/meson.build +++ b/src/test/modules/injection_points/meson.build @@ -44,6 +44,7 @@ tests += { 'specs': [ 'basic', 'inplace', + 'markers', ], }, 'tap': { diff --git a/src/test/modules/injection_points/specs/markers.spec b/src/test/modules/injection_points/specs/markers.spec new file mode 100644 index 00000000000..e9f56d7567b --- /dev/null +++ b/src/test/modules/injection_points/specs/markers.spec @@ -0,0 +1,45 @@ +setup +{ + CREATE EXTENSION injection_points; +} +teardown +{ + DROP EXTENSION injection_points; +} + +# Wait happens in the first session, wakeup in the second session. +session s1 +setup { + SELECT injection_points_set_local(); + SELECT injection_points_attach('injection-points-wait-1', 'wait'); +} +step after { SELECT injection_points_run('injection-points-wait-1'); } + +session s2 +setup { + SELECT injection_points_set_local(); + SELECT injection_points_attach('injection-points-wait-2', 'wait'); +} +step before { SELECT injection_points_run('injection-points-wait-2'); } + +session s3 +step wakeup1 { SELECT injection_points_wakeup('injection-points-wait-1'); } +step detach1 { SELECT injection_points_detach('injection-points-wait-1'); } +step wakeup2 { SELECT injection_points_wakeup('injection-points-wait-2'); } +step detach2 { SELECT injection_points_detach('injection-points-wait-2'); } + +permutation + after(before) + before + detach1 + wakeup1 + detach2 + wakeup2 + +permutation + after(before) + wakeup1 + before + detach1 + detach2 + wakeup2 \ No newline at end of file -- 2.43.0