I was writing a new C test to run from test_c_utils.py and I found that #include “config.h” is a problem for such tests, as we don’t know for sure where the config file is when the test is run. I see several solutions:
- Provide some environment variable to the test scripts which tells where to find
config.hso the appropriate-Iflag can be provided to the compiler. - Export and install
config.hininclude/graphviz/config.hand include it as<graphviz/config.h>(Though this might also need an env var to find, though perhaps we can assume we can find it from$PATH: look fordotexecutable and navigate from there.) - Remove
#include “config.h”from all.hfiles and useNO_CONFIGpreprocessor definiition as already done inlist.cto supporttest_list.c.- Note that
list.cis lucky in that it has a small include list, and misses the list below - Currently, a small number of .h files have
#include “config.h”, and need to be fixed:- cmd/gvedit/csettings.h
cmd/tools/convert.h
lib/cgraph/cghdr.h
lib/cgraph/ingraphs.h
lib/common/colorprocs.h
lib/common/render.h
lib/fdpgen/grid.h
lib/neatogen/neato.h
lib/neatogen/sparsegraph.h
lib/sfdpgen/sfdp.h
lib/sfio/sfhdr.h
lib/sfio/sfio.h
plugin.demo/xgtk/src/support.h
- cmd/gvedit/csettings.h
- Also, the generated parser files currently only see
config.hbecause it’s included by some.hfiles they include. This must also be fixed, as without seeing theconfig.hthey are buggy.:- cmd/tools/gmlparse.y
lib/cgraph/grammar.y
lib/cgraph/scan.l
lib/common/htmlparse.y
lib/expr/exparse.y
- cmd/tools/gmlparse.y
- Note that
I Vote for #3 and can send out an MR if supported, though perhaps there are reasons to go with a different solution. Please let me know.
-Brian