[sheepdog] [PATCH v1] unittest: fix coredump bug for unit-test

Liu Yuan namei.unix at gmail.com
Wed Jul 2 11:37:37 CEST 2014


On Mon, Jun 30, 2014 at 06:31:20PM +0800, Robin Dong wrote:
> From: Robin Dong <sanbai at taobao.com>
> 
> Test case in test_hash.c will call create_vdisks() which need to
> check sys->cinfo.flags, but variable 'sys' is uninitialized in
> unit-test environment. Therefore we need to init 'sys' before
> calling create_vdisks().
> 
> Reported-by: Ruoyu <liangry at ucweb.com>
> Signed-off-by: Robin Dong <sanbai at taobao.com>
> ---
>  tests/unit/sheep/test_hash.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/unit/sheep/test_hash.c b/tests/unit/sheep/test_hash.c
> index 26386b9..7779288 100644
> --- a/tests/unit/sheep/test_hash.c
> +++ b/tests/unit/sheep/test_hash.c
> @@ -605,7 +605,9 @@ static Suite *test_suite(void)
>  
>  int main(void)
>  {
> +	struct system_info __sys;
>  	int number_failed;
> +	sys = &__sys;
>  	Suite *s = test_suite();
>  	SRunner *sr = srunner_create(s);
>  	srunner_run_all(sr, CK_NORMAL);
> -- 
> 1.7.12.4
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog

Applied thanks

Yuan



More information about the sheepdog mailing list