console: Restore old pager test-bypass value

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>
This commit is contained in:
Simon Glass
2025-09-22 09:51:27 -06:00
parent 08faed68c3
commit b54422a25d
2 changed files with 7 additions and 6 deletions

View File

@@ -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);

View File

@@ -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)