Ack with minor comments:
* the parameter type of aisrc_validate() should be SaAisErrorT
* the parameter type of rc_validate() should be int
* extern not needed
/Hans

> -----Original Message-----
> From: Lennart Lund
> Sent: den 3 september 2013 10:11
> To: [email protected]; Hans Feldt
> Cc: [email protected]
> Subject: [PATCH 2 of 4] logtest: New function for validate in test fm when 
> using external tools e.g. immadm. [#541]
> 
>  tests/unit_test_fw/inc/utest.h |  17 ++++++++++
>  tests/unit_test_fw/src/utest.c |  70 
> ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 87 insertions(+), 0 deletions(-)
> 
> 
> Testcases must work with different system configurations (#541) part 02
> 
> - Created function aisrc_validate() that will replace test_validate() which 
> is marked
>   as deprecated.
> - Added function rc_validate() in unit test fw. A variant of existing
>   function test_validate().
> 
> diff --git a/tests/unit_test_fw/inc/utest.h b/tests/unit_test_fw/inc/utest.h
> --- a/tests/unit_test_fw/inc/utest.h
> +++ b/tests/unit_test_fw/inc/utest.h
> @@ -45,12 +45,29 @@ extern void test_case_add(unsigned int s
> 
>  /**
>   * Validate and print result of a test case.
> + * NOTE: Deprecated. Use aisrc_validate()
>   * @param actual actual status code
>   * @param expected expected status code
>   */
>  extern void test_validate(SaUint32T actual, SaUint32T expected);
> 
>  /**
> + * Validate and print result of a test case.
> + * Used when rc is an SA_AIS_XXX return code
> + * @param actual actual status code
> + * @param expected expected status code
> + */
> +extern void aisrc_validate(SaUint32T rc, SaUint32T expected);
> +
> +/**
> + * Validate and print result of a test case.
> + * Used when rc is an exit code from an external tool e.g. immadm
> + * @param rc
> + * @param expected
> + */
> +void rc_validate(SaUint32T rc, SaUint32T expected);
> +
> +/**
>   * Run all test cases, all test cases in a suite or a specific
>   * test case. suites will be run in increasing order using the
>   * test suite number. Test cases will be run in order installed.
> diff --git a/tests/unit_test_fw/src/utest.c b/tests/unit_test_fw/src/utest.c
> --- a/tests/unit_test_fw/src/utest.c
> +++ b/tests/unit_test_fw/src/utest.c
> @@ -46,6 +46,14 @@ static unsigned int current_test;
> 
>  unsigned int testdebug;
> 
> +/**
> + * Used when rc is an SA_AIS_XXX reurn code
> + *
> + * NOTE: Deprecated. Use aisrc_validate()
> + *
> + * @param rc
> + * @param expected
> + */
>  void test_validate(SaUint32T rc, SaUint32T expected)
>  {
>      /* Save for later use */
> @@ -68,6 +76,68 @@ void test_validate(SaUint32T rc, SaUint3
>      test_total++;
>  }
> 
> +/**
> + * Used when rc is an SA_AIS_XXX reurn code
> + *
> + * @param rc
> + * @param expected
> + */
> +void aisrc_validate(SaUint32T rc, SaUint32T expected)
> +{
> +    /* Save for later use */
> +    actualStatus = rc;
> +    expectedStatus = expected;
> +
> +    if (rc == expected)
> +    {
> +        test_passed++;
> +        printf("  %3d  PASSED", current_test);
> +        last_test_status = 0;
> +    }
> +    else
> +    {
> +        test_failed++;
> +        printf("  %3d  FAILED", current_test);
> +        last_test_status = -1;
> +    }
> +
> +    test_total++;
> +}
> +
> +/**
> + * Used when rc is an exit code from an external tool e.g. immadm
> + *
> + * @param rc
> + * @param expected
> + */
> +void rc_validate(SaUint32T rc, SaUint32T expected)
> +{
> +     char *exit_str[] = {"EXIT_SUCCESS","EXIT_FAILURE"};
> +     char other_str[] = "UNKNOWN";
> +     char *rcstr, *expstr;
> +
> +    /* Save for later use */
> +    actualStatus = rc;
> +    expectedStatus = expected;
> +    last_test_status = 0;
> +
> +    if (rc == expected)
> +    {
> +        test_passed++;
> +        printf("  %3d  PASSED", current_test);
> +    }
> +    else
> +    {
> +        test_failed++;
> +        printf("  %3d  FAILED", current_test);
> +             rcstr = (rc < 2) ? exit_str[rc]: other_str;
> +             expstr = (expected < 2) ? exit_str[expected]: other_str;
> +             printf("\t(expected %s, got %s (%d))",expstr, rcstr, rc);
> +    }
> +
> +    test_total++;
> +}
> +
>  void test_suite_add(unsigned int suite, const char *name)
>  {
>      suite_name[suite] = name;

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to