3.6.1 Creating a Portable Test

Tests require installation-dependent path information to find the components. The process that follows illustrates a portable test example.

  1. Pick an suitably informative name for the test. Here we use ``odetest''.

  2. In components/tests/odetest.rc.in create the portable test script by omitting any component path information:
    create demo.Driver Driver
    create demo.Integrator Integrator
    create demo.Function Function
    connect Driver integrate Integrator integrate
    connect Integrator odeRHS Function fun
    go Driver run
    exit
    

  3. Modify the post-build-user rule in components/make.rules.user to generate the non-portable, complete test. Between the dprint statements, insert code to join the build-generated instantiation test rc file to your portable test.
    post-build-user::
            $(dprint) "Build hook $@ in $(MYDIR) started"
    	cat tests/instantiation.gen.rc | \
    		grep -v instantiate | grep -v display | \
    		grep -v remove | grep -v quit > tests/load.gen.rc
    	cat tests/load.gen.rc \
    		tests/odetest.rc.in > tests/odetest.rc
            $(dprint) "Build hook $@ in $(MYDIR) completed"
    
    Remember that makefile lines must be tabbed, not started with spaces.

  4. Add the completed test script to the test list by simply:

    $ echo "components_TESTS += odetest.rc" » \
    components/make.vars.user

    As many tests as desired can be added to the list in this way.

  5. Run  make again to cause generation of odetest.rc.

  6. Run  make user-tests run the completed test file.

If you have multiple tests to manage, you may wish to create and add suffix rules that perform this conversion process. Future releases of Bocca will likely further automate the process of making test scripts portable.

2010-08-11