summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell2020-03-03 13:03:59 +0100
committerPeter Maydell2020-03-03 13:03:59 +0100
commit104933c4a973960dea605b06fcd5d0d478255d77 (patch)
tree6f2826fb3e62909fcc2d5d3018a82e0d8b93c7fc /tests
parentMerge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-5.0-sf3' i... (diff)
parentl2tpv3: fix RFC number typo in qemu-options.hx (diff)
downloadqemu-104933c4a973960dea605b06fcd5d0d478255d77.tar.gz
qemu-104933c4a973960dea605b06fcd5d0d478255d77.tar.xz
qemu-104933c4a973960dea605b06fcd5d0d478255d77.zip
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
# gpg: Signature made Tue 03 Mar 2020 10:06:06 GMT # gpg: using RSA key EF04965B398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211 * remotes/jasowang/tags/net-pull-request: (23 commits) l2tpv3: fix RFC number typo in qemu-options.hx colo: Update Documentation for continuous replication net/filter.c: Add Options to insert filters anywhere in the filter list tests/test-replication.c: Add test for for secondary node continuing replication block/replication.c: Ignore requests after failover hw: net: cadence_gem: Fix build errors in DB_PRINT() NetRxPkt: fix hash calculation of IPV6 TCP NetRxPkt: Introduce support for additional hash types e1000e: Avoid hw_error if legacy mode used dp8393x: Don't stop reception upon RBE interrupt assertion dp8393x: Don't reset Silicon Revision register dp8393x: Always update RRA pointers and sequence numbers dp8393x: Clear descriptor in_use field to release packet dp8393x: Pad frames to word or long word boundary dp8393x: Use long-word-aligned RRA pointers in 32-bit mode dp8393x: Don't clobber packet checksum dp8393x: Implement packet size limit and RBAE interrupt dp8393x: Clear RRRA command register bit only when appropriate dp8393x: Update LLFA and CRDA registers from rx descriptor dp8393x: Have dp8393x_receive() return the packet size ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-replication.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/test-replication.c b/tests/test-replication.c
index 4747d8a6be..cbc37db2df 100644
--- a/tests/test-replication.c
+++ b/tests/test-replication.c
@@ -490,6 +490,56 @@ static void test_secondary_stop(void)
teardown_secondary();
}
+static void test_secondary_continuous_replication(void)
+{
+ BlockBackend *top_blk, *local_blk;
+ Error *local_err = NULL;
+
+ top_blk = start_secondary();
+ replication_start_all(REPLICATION_MODE_SECONDARY, &local_err);
+ g_assert(!local_err);
+
+ /* write 0x22 to s_local_disk (IMG_SIZE / 2, IMG_SIZE) */
+ local_blk = blk_by_name(S_LOCAL_DISK_ID);
+ test_blk_write(local_blk, 0x22, IMG_SIZE / 2, IMG_SIZE / 2, false);
+
+ /* replication will backup s_local_disk to s_hidden_disk */
+ test_blk_read(top_blk, 0x11, IMG_SIZE / 2,
+ IMG_SIZE / 2, 0, IMG_SIZE, false);
+
+ /* write 0x33 to s_active_disk (0, IMG_SIZE / 2) */
+ test_blk_write(top_blk, 0x33, 0, IMG_SIZE / 2, false);
+
+ /* do failover (active commit) */
+ replication_stop_all(true, &local_err);
+ g_assert(!local_err);
+
+ /* it should ignore all requests from now on */
+
+ /* start after failover */
+ replication_start_all(REPLICATION_MODE_PRIMARY, &local_err);
+ g_assert(!local_err);
+
+ /* checkpoint */
+ replication_do_checkpoint_all(&local_err);
+ g_assert(!local_err);
+
+ /* stop */
+ replication_stop_all(true, &local_err);
+ g_assert(!local_err);
+
+ /* read from s_local_disk (0, IMG_SIZE / 2) */
+ test_blk_read(top_blk, 0x33, 0, IMG_SIZE / 2,
+ 0, IMG_SIZE / 2, false);
+
+
+ /* read from s_local_disk (IMG_SIZE / 2, IMG_SIZE) */
+ test_blk_read(top_blk, 0x22, IMG_SIZE / 2,
+ IMG_SIZE / 2, 0, IMG_SIZE, false);
+
+ teardown_secondary();
+}
+
static void test_secondary_do_checkpoint(void)
{
BlockBackend *top_blk, *local_blk;
@@ -585,6 +635,8 @@ int main(int argc, char **argv)
g_test_add_func("/replication/secondary/write", test_secondary_write);
g_test_add_func("/replication/secondary/start", test_secondary_start);
g_test_add_func("/replication/secondary/stop", test_secondary_stop);
+ g_test_add_func("/replication/secondary/continuous_replication",
+ test_secondary_continuous_replication);
g_test_add_func("/replication/secondary/do_checkpoint",
test_secondary_do_checkpoint);
g_test_add_func("/replication/secondary/get_error_all",