lkml.org 
[lkml]   [2018]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 3/3] lib/test_crc: Add test cases for crc calculation
From
Date
Hi,

On 07/17/2018 07:55 AM, Coly Li wrote:

> diff --git a/lib/test_crc.c b/lib/test_crc.c
> new file mode 100644
> index 000000000000..441bf835fbd3
> --- /dev/null
> +++ b/lib/test_crc.c
> @@ -0,0 +1,138 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * CRC test driver
> + *
> + * Copyright (C) 2018 Coly Li <colyli@suse.de>
> + *

> +
> +static int __init test_crc_init(void)
> +{
> + int i;
> + int v, err = 0;
> +
> + pr_info("Kernel CRC consitency testing:\n");

consistency

> + for (i = 0; test_data[i].name; i++) {
> + v = test_data[i].handler(&test_data[i]);
> + if (v < 0)
> + err++;
> + }
> +
> + if (err == 0)
> + pr_info("test_crc: all %d tests passed\n", i);
> + else
> + pr_err("test_crc: %d cases tested, %d passed, %d failed\n",
> + i, i - err, err);
> +
> + return (err == 0) ? 0 : -EINVAL;
> +}


--
~Randy

\
 
 \ /
  Last update: 2018-07-17 18:58    [W:0.124 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site