source: rtems/testsuites/sptests/sp58/init.c @ d5ae827

4.104.115
Last change on this file since d5ae827 was d5ae827, checked in by Joel Sherrill <joel.sherrill@…>, on 07/09/09 at 18:21:58

2009-07-09 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, configure.ac: Add test for timespec divide by zero.
  • sp58/.cvsignore, sp58/Makefile.am, sp58/init.c, sp58/sp58.doc, sp58/sp58.scn: New files.
  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#include <tmacros.h>
13
14#include <sys/types.h>
15#include <rtems/score/timespec.h>
16#include <rtems/score/threadq.h>
17
18void timespec_divide_by_zero(void)
19{
20  struct timespec      t1;
21  struct timespec      zero;
22  uint32_t             ival_percentage;
23  uint32_t             fval_percentage;
24
25  t1.tv_sec  = 1;
26  t1.tv_nsec = 0;
27
28  zero.tv_sec  = 0;
29  zero.tv_nsec = 0;
30
31  ival_percentage = 1234;
32  fval_percentage = 5678;
33
34  puts( "Init - _Timespec_Divide - by zero" );
35  _Timespec_Divide( &t1, &zero, &ival_percentage, &fval_percentage );
36  rtems_test_assert( ival_percentage == 0 );
37  rtems_test_assert( fval_percentage == 0 );
38 
39}
40
41rtems_task Init(
42  rtems_task_argument ignored
43)
44{
45  puts( "\n\n*** TEST 58 ***" );
46
47  timespec_divide_by_zero();
48
49  puts( "*** END OF TEST 58 ***" );
50  rtems_test_exit(0);
51}
52
53/* configuration information */
54
55#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
56#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
57
58#define CONFIGURE_MAXIMUM_TASKS  1
59#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
60
61#define CONFIGURE_INIT
62#include <rtems/confdefs.h>
63
64/* global variables */
Note: See TracBrowser for help on using the repository browser.