summaryrefslogtreecommitdiffstats
path: root/tests/lifecycle.c
diff options
context:
space:
mode:
authorAnastasia Klimchuk <aklm@chromium.org>2022-09-14 08:51:54 +1000
committerEdward O'Callaghan <quasisec@chromium.org>2022-09-20 23:45:08 +0000
commit5363f35fa03e4db2cd79032ca9860c0c5382a355 (patch)
treec69fd9e692bd589a1e6ee29dcfca81f68bd2117f /tests/lifecycle.c
parent5d05a2811e67903c7de091ca053d46a831c62b2b (diff)
downloadflashrom-5363f35fa03e4db2cd79032ca9860c0c5382a355.tar.gz
flashrom-5363f35fa03e4db2cd79032ca9860c0c5382a355.tar.bz2
flashrom-5363f35fa03e4db2cd79032ca9860c0c5382a355.zip
tests: Add unit test for initialisation with NULL programmer param
Programmer param can be NULL and this is a valid case which can be covered by unit test. `run_lifecycle` needs an adjustment to handle NULL as programmer param, which is also included in the patch. Change-Id: I409f1c9ac832943e54107f7cf8652d1f46ac67df Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67642 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Thomas Heijligen <src@posteo.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'tests/lifecycle.c')
-rw-r--r--tests/lifecycle.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/lifecycle.c b/tests/lifecycle.c
index 568b1790f..0c7969920 100644
--- a/tests/lifecycle.c
+++ b/tests/lifecycle.c
@@ -39,7 +39,8 @@ static void run_lifecycle(void **state, const struct io_mock *io, const struct p
io_mock_register(io);
struct flashrom_programmer *flashprog;
- char *param_dup = strdup(param);
+
+ char *param_dup = param ? strdup(param) : NULL;
printf("Testing flashrom_programmer_init for programmer=%s ...\n", prog->name);
assert_int_equal(0, flashrom_programmer_init(&flashprog, prog->name, param_dup));