EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Unit testing for databases
From: "Wang, Andrew via Tech-talk" <tech-talk at aps.anl.gov>
To: Michael Davidsaver <mdavidsaver at gmail.com>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Sun, 25 Sep 2022 09:27:34 +0000
Thanks Michael and Simon! I was able to get a unit test for an IOC working. I created a test directory within an IOC and made a Makefile along with a main.c that contained some dbGet and dbPut test statements.

My makefile essentially starts with TOP and include $(TOP)/configure/CONFIG followed by the statements from the example in epicsUnitTest.h Doxygen page. Then I ended it with include $(TOP)/configure/RULES.

I was able to compile and link the main and recorddevicedriver object files and EPICS libraries! Got a 100% pass rate, which is also nice.

Question though. Shouldn't the example C code also include testMain.h since we are using MAIN, which is a macro defined in that header file?

From: Michael Davidsaver <mdavidsaver at gmail.com>
Sent: Saturday, September 24, 2022 9:33 PM
To: Wang, Andrew <wang126 at llnl.gov>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Subject: Re: Unit testing for databases
 
On 9/23/22 01:02, Wang, Andrew via Tech-talk wrote:
> Hi all,
>
> I am attempting to create a unit test for an IOC I had written per project specification. I have been attempting to follow the example on this Doxygen page (EPICS Base: Unit testing of record processing (anl.gov) <https://urldefense.us/v3/__https://epics.anl.gov/base/R7-0/6-docs/doxygen/dbunittest.html__;!!G2kpM7uM-TzIFchu!gLi2eI6CwW4YBoHkox7lDvPUMsGc97vMbGDetU5i6VR8dd3qQ7tKd3TXmlKv_yeTVa8$ >), however I seem to have hit a road block. My questions are below.
>
>  1. In the Makefile example, are those variables for the Makefile inside the app/src directory of an IOC application?

I typically put tests in another directory, although is no necessary.
TESTPROD executables are only special in that they are not installed.


>  2. Do the contents of the Makefile example go after the comment, which reads # ADD RULES AFTER THIS LINE?

Like most assignments, put them after

> include $(TOP)/configure/CONFIG

and before

> include $(TOP)/configure/RULES


>  3. Is pdbbase the same global variable as described in Chapter 14 which is titled "Static Database Access"? If so, then I would need to include dbAccess.h?

Yes, and Yes.


>  4. What is the TESTFILES variable for? I couldn't find an explanation in the Application Developer's Guide.

This is used to capture files which are read by test executables.
Currently only used when running tests on RTEMS/vxWorks.

Replies:
Re: Unit testing for databases Michael Davidsaver via Tech-talk
References:
Unit testing for databases Wang, Andrew via Tech-talk
Re: Unit testing for databases Michael Davidsaver via Tech-talk

Navigate by Date:
Prev: Re: Unit testing for databases Michael Davidsaver via Tech-talk
Next: Re: Unit testing for databases Michael Davidsaver via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
Navigate by Thread:
Prev: Re: Unit testing for databases Michael Davidsaver via Tech-talk
Next: Re: Unit testing for databases Michael Davidsaver via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024 
ANJ, 25 Sep 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·