davidchisnall / dtc

FreeBSD Device Tree Compiler
18 stars 17 forks source link

Fix incbin issue #25, provide test case #33

Closed kevans91 closed 6 years ago

kevans91 commented 6 years ago

I don't necessarily like what I've done in Tests/testexpected.sh to make this work, but I couldn't come up with a cleaner way to test this that is just as safe.

The problem was generally that text_input_buffer::read_binary_file was handling absolute paths wrong, prepending dir/ to the filename regardless of what filename looked like. This PR addresses it by checking if filename is an absolute path and leaving it as-is if so. We also don't fallback to include_paths checks if we're given an absolute path.

davidchisnall commented 6 years ago

I think the fix is correct. The only better solution I can think of to the test is to preprocess the tests and pass pwd as a predefined value. It might be good to have some tests that are passed through cpp first anyway, to make sure that we correctly ignore line number things.