This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] command argument "--preload"

On 11/5/18 4:16 AM, David Newall wrote:
> On 24/10/18 9:24 pm, Florian Weimer wrote:
>> For some reason, the [--preload] patch as posted does not apply to
>> master.
>> I think the general approach of the patch is fine.  Could you write
>> a test case for it?
> I hate to say this, but I can't work out how to write a test case.
> Normally I'd crib from something similar, but I can't find any test
> cases for any of rtld's arguments.  (In all cases where I can find
> arguments for rtld, it's not rtld that's being tested, but something
> else.)

Is elf/ a useful template?

You will need:

* 3 parts in elf/Makefile, a binary you're going to build for the
  test, and two shared objects that provide the same function, the
  default one exits with a non-zero exit code, and the preloading
  one which exits with a zero exit code.
* The test itself e.g., with a dependency on the
  DSOs and binary so they get built. It will be tests-special and
  have it's own rule to run the test, and pass in the right
  arguments along with an additional argument of the path to the
  binary to run.
* The script will run the loader with --preload
  and try to load the new DSO, and run the test. It return 0 if
  it was able to successfully preload the DSO and interpose the
  function and you can catch that in your script and exit with
  a zero also to indicate the test passed e.g. just passing along
  the return code and printing some information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]