Buildd-setup faffing around with __FILE__ breaks my unit tests.

Ximin Luo infinity0 at debian.org
Sun Feb 10 19:17:00 GMT 2019


Sune Vuorela:
> On Sunday, February 10, 2019 8:00:00 PM CET Ximin Luo wrote:
>> i.e. QT tests shouldn't use __FILE__, they should use something else.
> 
> What should they use?  A custom macro that the build system passes into 
> instead?
> 
> That's just silly. So what are your actual suggestion to find the source tree 
> from executables in the build tree?
> 
> Note that this is all about tests, so nothing shipped to actual users, so 
> reproducibility should be a non-issue here.
> 
>> Patching this one macro is easier than patching several hundred packages
>> that use __FILE__ directly for more innocent (less assumptive) purposes
>> that are unaffected by -ffile-prefix-mpa.
> 
> What do you consider acceptable usecases for __FILE__ ?
> 

Acceptable usecases are those that make fewest assumptions about the behaviour of __FILE__, which has never been guaranteed to do what the QT test macro assumes it does.

I think it's extremely short-sighted (and selfish, actually) to feel entitled that non-QT projects should patch away their uses of __FILE__ *that make less assumptions about what __FILE__ does* but QT should not do this minimal amount of work to change one test macro.

Lots of other test runners do perfectly well without __FILE__, QT tests are not special.

X

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git



More information about the Reproducible-builds mailing list