GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PBI / V0-1-5 > test_alias / rhel5-64


Interface   Data Structures   File List   Data Fields   Globals  

test_alias.c File Reference

Unit test of the macros in PBI/Alias.h. More...

#include <stdio.h>
#include <PBI/Alias.h>
#include <PBI/Attribute.h>

Defines

#define TEST_MISSION
 Symbol representing the string stating the mission of this test. It is purely here to make the code read nicer.

Functions

int main (int argc, char **argv)
 Standard main entry point for Unix platforms. It merely calls the testing routine test_alias ().
static void Original_Function (void)
 Acts to define the non-aliased function address. This is the routine's sole purpose, it is never actually called.
void Aliased_Function (int)
 Acts to define the aliased symbol. One must first generate a reference to the symbol to be aliased, then use the alias macros to define the value of this symbol. This is the routine's sole purpose, it is never actually called.
int test_alias (void)
 The test program itself and also the entry point for running this test on VxWork's platforms.


Detailed Description

Unit test of the macros in PBI/Alias.h.

Author:
JJRussell - russell@slac.stanford.edu
This tests the ability to define alias names for functions using the macros defined in PBI/Alias.h. As with many of the tests in PBI, if this test code compiles, it is 90% tested. The dynamic part of this tests if an aliased symbol, does indeed have the same address as the original symbol. This could also be accomplished by running nm on the compiled object of this program and verifying that Original_Function and Aliased_Function have the same address.

   CVS $Id: test_alias.c,v 1.5 2011/03/24 20:50:58 apw Exp $

To run the program type


   On Unix platforms: 
   $ test_alias

   On VxWorks
   > test_alias ()

 

The program returns 0 if successful, else -1.


Define Documentation

#define TEST_MISSION

Value:

"\n"                                                     \
"\n"                                                                          \
" Test of Symbol Aliasing\n"                                                  \
" -----------------------\n"                                                  \
" This tests the ability to define alias names for functions using the\n"     \
" macros defined in PBI/Alias.h. As with many of the tests in PBI, if this\n" \
" test code compiles, it is 90% tested. The dynamic part of this tests if\n"  \
" an aliased symbol does indeed have the same address as the original\n"      \
" symbol. This could also be accomplished by running nm on the compiled\n"    \
" object of this program and verifying that Original_Function and\n"          \
" Aliased_Function have the same address.\n"
Symbol representing the string stating the mission of this test. It is purely here to make the code read nicer.

Referenced by test_alias().


Function Documentation

int main ( int  argc,
char **  argv 
)

Standard main entry point for Unix platforms. It merely calls the testing routine test_alias ().

Return values:
0,if successful
-1,if unsuccessful
This program takes no arguments.

References test_alias().

int test_alias ( void   ) 

The test program itself and also the entry point for running this test on VxWork's platforms.

Return values:
0,if successful
-1,if unsucceful

References Aliased_Function(), and TEST_MISSION.

Referenced by main().


Generated on Thu Aug 4 14:24:03 2011 by  doxygen 1.5.8