[PATCH 0/3] Waf: Semi-automatic generation of results for cross-answers files

Uri Simchoni urisimchoni at gmail.com
Thu Apr 30 14:21:47 MDT 2015

One of the methods for cross-compiling samba is to provide a cross-answers file,
which contains the results of configure tests which have to run on the target.
However, there's no automation in getting the correct answer for the target.

This patchset adds an option to save the compiled test binaries in a directory,
along with a modified cross-answers file, detailing the binary to run for each
test with unknown result. A script is also supplied to run on the target, run
the test binaries, and patch cross-answers file with the test result.

Typical workflow:
1. ./configure --cross-compile --cross-answers=<ca_file> --cross-test-dir=<some empty dir>
   -  ca_file is name of the partially-filled or non-existant cross-answers file.
   -  --cross-test-dir is the new switch
   -  configure updates the cross-answers file as always and also copies all binaries
      of tests with unknown result into the cross-test-dir. It also places there a
      version of the cross-answers file which includes the name of binary to run for
      each test.
2. Copy the supplied run-cross-tests.sh shell script into the cross-test-dir
3. Copy all files into the target (or have target mount the cross-test-dir
4. On target, cd into the dir where all files reside and run:
   ./run-cross-tests.sh < <ca_file> > <new_ca_file>
   - This step scans the cross-answers file, and for each test with unknown result,
     runs the test binary and forms a proper result out of the exit status and
     standard output.

This is not bullet-proof - two tests relating to shared libraries also required
copying a built shared library to the target, and hence fail. However, it is still
an improvement over the current state of having to guess the result of 30-odd tests
or manually run them.

Patch summary:
Patch #1 is just a refactoring to make things easier.
Patch #2 adds the --cross-test-dir option
Patch #3 is the run-cross-tests.sh script

Uri Simchoni (3):
  cross-answers file - use internal dictionary
  Add --cross-test-dir parameter to save tests for running on target
  Add a script to run cross-compiled configure tests on target

 buildtools/scripts/run-cross-tests.sh |  43 +++++++++++++
 buildtools/wafsamba/samba_cross.py    | 112 ++++++++++++++++++++++------------
 buildtools/wafsamba/wscript           |   4 ++
 3 files changed, 120 insertions(+), 39 deletions(-)
 create mode 100755 buildtools/scripts/run-cross-tests.sh


More information about the samba-technical mailing list