<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 19, 2020 at 7:05 PM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 19/08/2020 15:04, Eshan dhawan wrote:<br>
<br>
> diff --git a/testsuites/psxtests/psxconfstr/init.c b/testsuites/psxtests/psxconfstr/init.c<br>
> new file mode 100644<br>
> index 0000000000..8660f04b29<br>
> --- /dev/null<br>
> +++ b/testsuites/psxtests/psxconfstr/init.c<br>
> @@ -0,0 +1,137 @@<br>
> +/*<br>
> + *  @file<br>
> + *  @brief Test suite for getcpuclockid methods<br>
Really?<br></blockquote><div>I took the template from that file <br></div><div>Forgot to change it :)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> + */<br>
> +<br>
> +/*<br>
> + * SPDX-License-Identifier: BSD-2-Clause<br>
> + *<br>
> + * Copyright (C) 2020 embedded brains GmbH, Eshan Dhawan<br>
<br>
Please follow the source file template:<br>
<br>
<a href="https://docs.rtems.org/branches/master/eng/coding-file-hdr.html#c-c-assembler-source-file-template" rel="noreferrer" target="_blank">https://docs.rtems.org/branches/master/eng/coding-file-hdr.html#c-c-assembler-source-file-template</a><br>
<br>
> + *<br>
> + * Redistribution and use in source and binary forms, with or without<br>
> + * modification, are permitted provided that the following conditions<br>
> + * are met:<br>
> + * 1. Redistributions of source code must retain the above copyright<br>
> + *    notice, this list of conditions and the following disclaimer.<br>
> + * 2. Redistributions in binary form must reproduce the above copyright<br>
> + *    notice, this list of conditions and the following disclaimer in the<br>
> + *    documentation and/or other materials provided with the distribution.<br>
> + *<br>
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"<br>
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br>
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE<br>
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br>
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS<br>
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN<br>
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)<br>
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE<br>
> + * POSSIBILITY OF SUCH DAMAGE.<br>
> + */<br>
> +<br>
> +#ifdef HAVE_CONFIG_H<br>
> +#include "config.h"<br>
> +#endif<br>
> +<br>
> +#include <errno.h><br>
> +#include <stdint.h><br>
> +#include <stdio.h><br>
> +#include <string.h><br>
> +#include <rtems.h><br>
> +#include <rtems/test.h><br>
> +#include <unistd.h><br>
> +<br>
> +#include <rtems/test.h><br>
> +#include <assert.h><br>
> +#include <rtems/bspIo.h><br>
> +<br>
> +#include "tmacros.h"<br>
> +#include "test_support.h"<br>
Please cut down the includes to the minimum.<br>
> +<br>
> +const char rtems_test_name[] = "PSXCONFSTR";<br>
> +<br>
> +/* Forward declaration to avoid warnings */<br>
> +void *POSIX_Init (void * argument);<br>
> +void *test_pthread(void *);<br>
> +<br>
> +static char buffer[512];<br>
> +<br>
> +static const T_action actions[] = {<br>
> +  T_report_hash_sha256,<br>
> +  T_check_task_context,<br>
> +  T_check_file_descriptors,<br>
> +  T_check_rtems_barriers,<br>
> +  T_check_rtems_extensions,<br>
> +  T_check_rtems_message_queues,<br>
> +  T_check_rtems_partitions,<br>
> +  T_check_rtems_periods,<br>
> +  T_check_rtems_regions,<br>
> +  T_check_rtems_semaphores,<br>
> +  T_check_rtems_tasks,<br>
> +  T_check_rtems_timers,<br>
> +  T_check_posix_keys<br>
> +};<br>
> +<br>
> +static const T_config config = {<br>
> +  .name = "psxconfstr",<br>
> +  .buf = buffer,<br>
> +  .putchar = rtems_put_char,<br>
> +  .buf_size = sizeof(buffer),<br>
> +  .verbosity = T_VERBOSE,<br>
> +  .now = T_now_clock,<br>
> +  .action_count = T_ARRAY_SIZE(actions),<br>
> +  .actions = actions<br>
> +};<br>
> +<br>
> +/* init test function begins */<br>
> +T_TEST_CASE(confstr)<br>
> +{<br>
> +<br>
> +int r;<br>
> +  char * buf ;<br>
> +  const char UPE[] = "unsupported programming environment";<br>
> +  size_t len1;<br>
> +  len1 = strlen(UPE) + 1;<br>
sizeof(UPE)<br>
> +  r = confstr(_CS_PATH, buf, sizeof(buf));<br>
> +  if (r != 0){<br>
> +    printf("This Function is not supported");<br>
> +  }<br>
Please don't add hand crafted output like this just use the check <br>
functions of the test framework.<br>
> +  T_quiet_psx_success(r);<br>
> +  r = confstr(_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, buf, sizeof(buf));<br>
> +  if ( r != len1 ){<br>
> +    printf("lenght not matched");<br>
> +  }<br>
> +  assert(r == len1);<br>
Use a check function of the test framework and not assert().<br>
> +<br>
> +}<br>
> +<br>
> +void *POSIX_Init (void * argument)<br>
> +{<br>
> +  int exit_code;<br>
> +<br>
> +  TEST_BEGIN();<br>
> +<br>
> +  T_register();<br>
> +  exit_code = T_main(&config);<br>
> +  if (exit_code == 0) {<br>
> +    TEST_END();<br>
> +  }<br>
> +<br>
> + rtems_test_exit(exit_code);<br>
> +<br>
> +}<br>
Please use an RTEMS initialization task and rtems_test_run().<br>
> +<br>
> +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br>
Do you need a clock driver?<br>
> +#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER<br>
> +<br>
> +#define CONFIGURE_MAXIMUM_POSIX_THREADS  2<br>
> +#define CONFIGURE_MAXIMUM_TASKS 1<br>
> +<br>
> +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION<br>
> +<br>
> +#define CONFIGURE_POSIX_INIT_THREAD_TABLE<br>
> +<br>
> +#define CONFIGURE_INIT<br>
> +<br>
> +#include <rtems/confdefs.h><br>
</blockquote></div></div>