Before executing t2c to generate files, please make sure you have prepared appropriate directory structure for your test suite (see Section 6.3, “Typical directory structure of a test suite (c_standalone target)”).
We need to use T2C file generator (t2c) to create the source code and Makefile for the test as well as prepare Makefiles common for the whole test suite. See Section 3, “T2C Command Line Tool” for the detailed information about command line syntax of t2c.
When generating test sources and other per-test files, t2c operates on a single .t2c file at once. To process
glib_arrays.t2c we have prepared, change current directory to
tut-examples/example01 and run the following command:
t2c --target=c_standalone example01-t2c example01-t2c/src/glib_arrays.t2c
This will create
Now call t2c without specifying .t2c file to generate common files for the test suite:
t2c --target=c_standalone example01-t2c
This will create
If we used c_gtest_nested target here instead of c_standalone, it would also be necessary to specify the list of groups of tests (names of .t2c files) when generating common files. We would do this using
--list-file) option of t2c. For details, see Section 3, “T2C Command Line Tool” and the description of
TEST_MODULE parameter in Section 5.7.2, “Special parameters defined by the file generator”.
We also need to copy the source code of the T2C API library for c_standalone target distributed with T2C to our test suite:
mkdir t2c_api cp -r `t2c --print-data-dir`/api/c_standalone t2c_api
Instead of calling t2c manually to generate necessary files, we can execute ./gen_files.sh c_standalone.
gen_files.sh script will process the entire test suite at once. First, it will run t2c for each .t2c file that we have prepared. then it will run it once again to generate common files for the test suite. It will also copy the sources of the appropriate T2C API library to the test suite for building. All this was performed manually above to show how it is actually done.