
From: Simon Glass <sjg@chromium.org> The test.py tests pass -P to sandbox to tell it to bypass the pager. Tests which change this value must restore it to the old value. Fix this, so that the -P setting remains in place across test runs. Signed-off-by: Simon Glass <sjg@chromium.org> --- test/common/pager.c | 7 ++++--- test/test-main.c | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/common/pager.c b/test/common/pager.c index 1ec27c14527..53902ab29a3 100644 --- a/test/common/pager.c +++ b/test/common/pager.c @@ -403,12 +403,13 @@ static int pager_test_bypass_mode(struct unit_test_state *uts) struct pager *pag; const char *text = "This text should be returned directly"; const char *result; + bool was_bypassed; /* Init with small page length to ensure paging would normally occur */ ut_assertok(pager_init(&pag, 2, 1024)); /* Enable bypass mode */ - pager_set_test_bypass(pag, true); + was_bypassed = pager_set_test_bypass(pag, true); /* Post text - should get original string back directly */ result = pager_post(pag, true, text); @@ -418,8 +419,8 @@ static int pager_test_bypass_mode(struct unit_test_state *uts) result = pager_next(pag, true, 0); ut_assertnull(result); - /* Disable bypass mode */ - pager_set_test_bypass(pag, false); + /* Restore old bypass mode */ + pager_set_test_bypass(pag, was_bypassed); /* Now pager should work normally */ result = pager_post(pag, true, text); diff --git a/test/test-main.c b/test/test-main.c index 77d8a9f689d..b27f892140c 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -708,7 +708,7 @@ int ut_run_list(struct unit_test_state *uts, const char *category, const char *test_insert) { ; - bool has_dm_tests = false; + bool was_bypassed, has_dm_tests = false; ulong start_offset = 0; ulong test_offset = 0; int ret; @@ -748,10 +748,10 @@ int ut_run_list(struct unit_test_state *uts, const char *category, memcpy(uts->fdt_copy, gd->fdt_blob, uts->fdt_size); } uts->force_run = force_run; - pager_set_test_bypass(gd_pager(), true); + was_bypassed = pager_set_test_bypass(gd_pager(), true); ret = ut_run_tests(uts, prefix, tests, count, select_name, test_insert); - pager_set_test_bypass(gd_pager(), false); + pager_set_test_bypass(gd_pager(), was_bypassed); /* Best efforts only...ignore errors */ if (has_dm_tests) -- 2.43.0