aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-08-18 22:05:23 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-08-18 22:05:23 -0700
commit1f666759fe6170a7be2399e794a4adfa32a82b1e (patch)
tree0aee360758d23229606977e7033bc65a65aa94db /tests
parent7618310d969295b610805b7240048e7e2a737f36 (diff)
warn on -I and -L to absolute paths, which may be to local system headers/libraries that are not portable
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index b80509ff..0a37db54 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -6968,6 +6968,19 @@ f.close()
self.assertContained('hello from lib', run_js(os.path.join(self.get_dir(), 'a.out.js')))
assert not os.path.exists('a.out') and not os.path.exists('a.exe'), 'Must not leave unneeded linker stubs'
+ def test_abspaths(self):
+ # Includes with absolute paths are generally dangerous, things like -I/usr/.. will get to system local headers, not our portable ones.
+
+ shutil.copyfile(path_from_root('tests', 'hello_world.c'), 'main.c')
+
+ for args, expected in [(['-I/usr/something'], True),
+ (['-L/usr/something'], True),
+ (['-Isubdir/something'], False),
+ (['-Lsubdir/something'], False),
+ ([], False)]:
+ err = Popen(['python', EMCC, 'main.c'] + args, stderr=PIPE).communicate()[1]
+ assert ('emcc: warning: -I or -L of an absolute path encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript)' in err) == expected, err
+
def test_local_link(self):
# Linking a local library directly, like /usr/lib/libsomething.so, cannot work of course since it
# doesn't contain bitcode. However, when we see that we should look for a bitcode file for that