Usually I write these posts after I have implemented something, but this time it is more of a planning session.
VICI uses an XML file to hold various bit of configuration data. A lot of those data items are the paths to things like data files or plug-in libraries. The location of those data and plug-in files changes depending on what stage we are considering. There are the following stages:
- The development project - this is where the code is written and unit tests are performed.
- The top project - this is for building and testing the entire suite of programs.
- Creating a distribution - the "make distcheck" command creates and tests the distribution.
- Checking the distribution - this is when the distribution has been installed into a test area and has been built but not installed. This is a "make check" that is done between "make" and "make install".
- Checking the installed distribution - this is a "make check" done after installation.
- The final stage - this is where the installed programs are used (or tested) without relying on the source, such as when it is installed from a pre-built RPM.
There are two ways that the system can handle these various paths. The simplest is to have alternate configuration files that are used for each stage. However, the configuration library (that reads and interprets the configuration file) is able to handle having multiple alternative paths which it checks in turn until it finds one. For example the configuration for a plug-in:
When attempting to load this plug-in it checks each path until it finds one.
The configuration library searches for the configuration file using various techniques. It can use a command line parameter, an environment variable, or search for particular files in the current directory, the user's home directory, or others. The first one found is used.
Currently the search path is
The first string is the key - in this case it means that the following entries are a command line parameter, -i, an environment variable, VICI_CONF, the file ./vici.xml, the file ~/.local/share/vici/vici.xml, and the remainder are direct paths.
What is the optimum set of configuration files?
Each development project should have its own configuration file. This would allow the project to manage its own configuration and testing without disturbing other projects. Eclipse can be set up to provide parameters to the test programs so that should be used to ensure the local one is found. However, we want to ensure that configuration options are not overlooked in the full suite build so the "make check" tests should use an environment variable that points to top/vici-dev.xml which will be the config file for the top project.
The builds and tests in the top project will use top/vici-dev.xml via VICI_CONF. This version of the configuration file will point to files that have not been installed.
There will be a second configuration file, top/vici-test.xml. This version will point to files that have been installed and include all the entries necessary for testing. This will also be accessed using VICI_CONF
The final version, vici.xml, will be used by the programs once they are installed. The support for testing will be removed, or commented out. This will be found using the default location in share/vici.