Compiler Testing Challenges
There are unique challenges in testing compilers. This is due to several key issues:
- Testing is difficult due to the complexity of the compiler since the source includes many algorithms involving instruction scheduling, register allocation, software pipelining, vector optimization, and so on.
- The test input domain is virtually infinite. Even if some inputs are erroneous or meaningless, the compiler must correctly handle those inputs without fatal internal errors, and must report reasonable messages back to the user.
In addition to these general compiler challenges, there are additional challenges in testing the TI compiler.
- The TI compiler must be tested across multiple targets and multiple option combinations.
- The TI compiler supports multiple execution platforms.
- The TI compiler supports a long-lived code base, in some cases extending to 25 or more years.
To overcome these challenges, the compiler command-line shell tool, the C I/O run-time libraries, and TI command-line simulators allows for batch processing of compiler testing. TI has developed extensive automation to handle the batch testing of the compiler.
There are several mechanisms in place to address compiler robustness at TI. Some key points:
- Re-use: The compiler supports a minimum of 6 different target architectures. There is extensive re-use of compiler technology across these targets in each compiler release. Some details:
- About 60% of the code base is target-independent.
- For any given compiler about 90% is target-independent.
- On average each line of source code is re-used 6 times.
- Test code is also re-used. Most tests developed for one compiler are leveraged for use with all targets.
- Peer Reviews: Development of compiler technology is handled through several review cycles before being added to the source base.
- Each new feature requires a functional review.
- Each new feature requires a separate design review.
- Prior to a code review, new features require a code overview where implementation details are analyzed and decided.
- Each change to the code base, even minor, is review by at least one other developer. Code reviews are performed on-line using [Code Collaborator].
- Check-ins to the code base are prevented until the reviews are completed.
- Analysis Tools: Several analysis tools are used both during development and during testing.
- Automation: The compiler build and validation process is entirely automated. The input to a compiler release validation includes a test plan and the final output of the validation is a tar file of all validation results as well as a summary report. Some automation details:
- The build and validation automation controls nightly builds and validations, as well as all release validations.
- [LSF] is used to leverage thousands of hosts to run the validations in parallel.
- Nightly builds/validations are run on thousands of hosts with a 12-16 hour running time.
- Release builds/validations are run on thousands of hosts with a 48-72 hour running time.
TI compiler validation is performed at 3 different stages.
- Prior to check-in: A "pre-commit validation" must successfully pass in order for a change to be allowed into the code base. This pre-commit validation contains a sampling of test suites designed to provide almost full coverage.
- Nightly validation: This tests a nightly build which incorporates all committed and approved changes from the previous day. The nightly validation must successfully pass in order for any new changes are allowed into the code base. This validation includes the complete test suites, expanded option combination testing, and random option combinations. In addition, the nightly validation will test interactions between all source updates from the previous day.
- Release validation: A release validation includes all complete test suites and each suite is tested with extensive option sets. These option sets will include hundreds of combinations. A release validation will compile over 200,000 individual executable, self-checking test cases.
Compiler Test Suites
Commercial Test Suites
The following commercial test suites are run during the compiler validations.
- Plum Hall C and C++
- The Plum Hall Validation Suite for C
- Suite++: The Plum Hall Validation Suite for C++
- Perennial C and C++
- CVSA Latest ISO C Validation Suite
- C++VS ISA C++ Validation Suite
- ACE C and C++
- SuperTest C/C++ Compiler Test and Validation Suite
- CodeSourcery C++
- C++ ARM ABI Test Suite
- Dinkumware C++/STL Validation
- Proofer for C++/STL Validation
- Nullstone C Validation
- Nullstone for C
- Optimization tests
- GNU C and C++ Testing
- Torture Tests
In-House Validation Suites
The following in-house developed test suites are run during the compiler validations.
- These are key loops that are checked for performance and correctness.
- These are common benchmark applications such as gsmefr, jpeg, mpeg, etc. Included in this group are industry performance benchmarks. Also included are customers applications which are run for performance, code-size, and/or correctness.
- Regression Tests
- The code for each bug report is added to the regression suite.
- Unit Tests
- These are black and white box tests of specific functionality.