diff options
author | Oliver O'Halloran <oohall@gmail.com> | 2016-08-17 15:32:53 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-08-30 16:59:47 +1000 |
commit | 9a002d1e89a0808337db70017ec5fe121bf59460 (patch) | |
tree | 098effdff12da21ae046ec51547c6d2f102f4857 /core/test | |
parent | f0ef4e2d26a89deff97d50942f40a77edcc40867 (diff) | |
download | talos-skiboot-9a002d1e89a0808337db70017ec5fe121bf59460.tar.gz talos-skiboot-9a002d1e89a0808337db70017ec5fe121bf59460.zip |
core/test: add test for nul check in nvram_format()
Adds a test for nvram_check() that the ibm,skiboot nvram partition is
correctly terminated.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/test')
-rw-r--r-- | core/test/run-nvram-format.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/test/run-nvram-format.c b/core/test/run-nvram-format.c index 2d0c2da5..b8ba6986 100644 --- a/core/test/run-nvram-format.c +++ b/core/test/run-nvram-format.c @@ -65,6 +65,12 @@ int main(void) nvram_image[0] = 0; assert(nvram_check(nvram_image,128*1024) != 0); + /* Does our NUL checking work? */ + assert(nvram_format(nvram_image, 128 * 1024) == 0); + h = (struct chrp_nvram_hdr *) nvram_image; + memset((char *) h + sizeof(*h), 0xFF, h->len * 16 - sizeof(*h)); + assert(nvram_check(nvram_image, 128 * 1024) != 0); + assert(nvram_format(nvram_image, 128*1024)==0); /* corrupt the length of the partition */ nvram_image[2] = 0; |