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

Uri Simchoni urisimchoni at gmail.com
Sun May 3 15:38:49 MDT 2015

This patchset automates the generation of cross-answers file for cross-compiling
samba. It takes a different approach than the first version of the patch, 
namely that instead of cacheing the built tests and run them later in one
batch, it runs each test immediately using the cross-execute parameter.

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.
The other method is the cross-execute parameter which typically points to a
target emulator. Cross-answer has the advantage of being more accurate, since
the results of the test depend on kernel configuration, something the emulator cannot
However, there's no automation in getting the correct answer for the target.
Realizing that cross-execute is actually not limited to emulators, but can be
used for running the test on an actual target, the solution is to use both
cross-answers and cross-execute parameters simultaneously, and fill
missing cross-answers by running cross-execute.

Typical workflow:
1. ./configure --cross-compile --cross-answers=<ca_file> --cross-execute=<cross-execute-script>
   -  ca_file is name of the partially-filled or non-existant cross-answers file.
   -  cross-execute is a script that runs the test on the target
   -  Note the simultaneous activation of both --cross-answers and --cross-execute.
      This combination activates the new mode.
2. Copy the resulting ca_file into someplace safe - this can be used
   later during production building.
3. Run production builds only with --cross-answers only - no link to the
   target is required.

Requirements of the cross-execute script:
Originally, the cross-execute parameter was created run an emulator. However,
it can actually be any script, which supports the follwing interface:
- The script runs on the build machine.
- Its last command-line arguments are the program to run and
  optional parameters for the command.
- It somehow causes the built program to run on a target (e.g. copy the files and
  invoke the progam via some remote shell)
- It outputs to standard output of the build machine the same output as the one
  emitted when running the test program on the target. The return value must also match.

A sample script that copies the files using rsync and then runs the test using telnet
is supplied.

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.

Uri Simchoni (3):
  waf: Support auto-filling of cross-answers by cross-execute
  waf: improve readability of cross-answers generated by cross-execute
  waf: example cross-execute script for running on target

 buildtools/examples/run_on_target.py | 105 +++++++++++++++++++++++++++++++++++
 buildtools/wafsamba/samba_cross.py   |  71 +++++++++++++++++------
 2 files changed, 158 insertions(+), 18 deletions(-)
 create mode 100755 buildtools/examples/run_on_target.py


More information about the samba-technical mailing list