The Linux Foundation

 

Become an Individual Member

DevChk

From The Linux Foundation

Contents

About

This is the devchk test suite, also known as lsb-hdrchk. It is used for development environment verification. This test suite verifies different values in specific header files that might affect the ABI sepcified by LSB. At the moment, this test is only used for internal activities and is not released as part of the certification program.

Note: this test can be built in TET (emulation) and non-TET mode. TET mode is not currently being used, but would be needed if the test were released externally.

Current Tests

  • Checks for constants. The test depends on constant type(float, int, longdouble, and so on - see Constant table description for more details). Note: not all the constant types are set automatically during data upload; the data should be arranged manually if specific checks are required for some constants.
  • Check types (struct, union, typedef, enum) - type existence and size are checked. For structs and unions, every member is checked - its size, name and offset. For enums, mebers values and names are checked. Bitfields are also checked.
  • Signature of funstions is checked. A little trick is used here; the check is performed not directly (i.e. the test suite will not report a failure when executed), but at a compilation time - if the function signature is not as expected, you'll see warnings about incorrect pointers cast. Be carefull with such warnings! They actually indicate mismatch between db data end headers under test.

Required/Proposed Tests

  • Introduce more types of constant and develop appropriate checks for them. Note: ISPRAS team is currently working on the macro checker that will allow to check if particular macro usage can lead to LSB-incomliant program.

Issues

  • CheckOffset is passed a default value of "`0`" which causes test cases to pass even if member type information is not in the database
  • Need option to build specific library. Currently the tool builds tests for all libaries. #FIXME
  • Need more verbosity to indicate number and description of passed and failed test cases.

Building DevChk

DevChk tests are generated by the mktests script located at misc-test/devchk/ts/devchk directory. It requires target LSB version to be passed using '-v' option, i.e.

./mktests -v 4.0

The script uses common variables (LSBDB, LSBUSER, LSBDBHOST and LSBDBPASSWD) to access the database.

The script generates one *.c file per header, hdrchk.c file that calls all the tests and makefile to compile them all.

DevChk can be built to either check the system headers (simply run make) or to test LSB SDK headers located at the /opt/lsb/include directory (to do this, set LSB_PRODUCT variable to any non-empty value before running make).

As a result of the build process, `hdrchk` executable is created that should be executed to obtain the test results. Note: For many kinds of issues dechk suggests SQL queris that should be executed to fix the database data.

Known Failures Handling

When building devchk with upstream headers, one may explore some issues which are caused by changes in headers that actually don't break the ABI and thus should be ignored. Since devchk tests are generated from the database, it is not good to make any fixes in the source files themselves. Instead, one should place necessary code that should be added to the test of particular header to the appropriate file with 'inc' suffix. The content of such file is inserted in the generated test before the target header inclusion. This is not very flexoble, but helps to easily solve most of issues.


[Article] [Discussion] [View source] [History]