* Integrate Google Mock (at their trunk SVN revision 410 --
http://code.google.com/p/googlemock/source/detail?r=410). Note only
a subset of files are included (things like the LICENSE file, the include/
directory, and the src/ directory)
* Revise the build rules for libgtest. Just compile gmock-all.cc, and
also compile gmock-all.cc to build a libgtest that includes both
Google Test and Google Mock. Initially I had a separate library, but
I didn't think it made sense to keep them separate.
* Add a RegalDispatchGMock.py dispatch generator, which generates
test/RegalDispatchGMock.cpp/.h, which in turn takes the C style
functions used by the Regal dispatch table and turns them into calls on
a Google Mock implementation. Modifies scripts/Export.py to know about
a test source code directory, and to invoke the new code generator.
* Add testRegalState.cpp which requires Google Mock work correctly, and
which adds a simple test that Regal::State::Depth::Set() invokes
the right series of calls in the dispatch layer in order to set a new
depth state.
* Remove the demonstrative test I added to tests/test_main.cpp, as there
are now many tests and this one was not valuable beyond the "Google
Test works" stage.
* Fix the null build. `make` and then `make` immediately afterwards
was rebuilding libraries since the libraries depended on the lib/
subdirectory, but that directory ended up with a modification time
later than that of the library, causing make to think it needed to
build the library again on the next round. Likewise there were
dependencies on bin/ for things that were then built into bin/.
Rather than having a rule `bin: mkdir -p bin`, I modified other
rules to do a `mkdir -p $(dir $@)` to ensure the destination
directory existed before running the linker or archiver.
* Fix a few other dependency issues I uncovered when doing `make clean
&& make -j20`, where some libraries were being used before being
built.
Caveats -- Please read!
1. Google Mock does quite a bit of code generation through its macros
and templated implementation. RegalDispatchGMock.cpp can take
minutes to compile, due to the size of the API. On my machine,
the output .o file is a huge 24 megabyte binary.
2. The incremental compile time is also unfortunately a bit large.
Touching testRegalState.cpp means reading and expanding the macros
in RegalDispatchMock.h, which takes tens of seconds to do.
Unfortunately with the way that Google Mock interfaces are defined,
there is no seperation of the mock interface from its
implementation. All tests that include RegalDispatchMock.h will
incur overhead in expanding macros and setting up class data for the
full API.
3. Google Mock by default only supports functions with at most ten
arguments. There were a handful of functions that are larger than
this in the dispatch interface. I chose to set up the code
generator to silently ignore these calls rather than forwarding
them to the generated mock interface.
Google Mock contains a number of .pump files which define a default
call arity of 10, and it is perfectly possible to invoke
googletest/scripts/pump.py to regenerate these files to allow for a
larger arity, but I felt that keeping the default for now was fine.
Regal looks like it needs an arity of 15 if all functions are to be
mocked.
Add the head version of GoogleTest (using
https://git.chromium.org/git/external/googletest.git), with a version
equivalent to Subversion change #625. Note that I've trimmed out some
parts of the tree that aren't directly related to building a working
library (such as their self-tests), but I preserved the special files in
the root directory of the project (such as LICENSE).
Modifies the Makefile to build "lib/libgtest.a" from the Google Test sources.
Adds a tests/ subdirectory for Regal tests. Adds a test_main.cpp file,
which will run all the tests, and contains a trivial test for
verification.
Modifies the Makefile to build and run "bin/RegalTests" from the
tests/ source code if "make tests" is run. The tests however are not
built/run by the "make all"