Fix build on karmic: Work around Python/tar bug
[nacl-build.git] / toolchain_test.py
bloba0258ca277e680e49ba923c17597f18af92761d5
2 import subprocess
3 import unittest
6 class ToolchainTests(unittest.TestCase):
8 def test_padding_unusual_code_sections(self):
9 # Test that ends of code sections are padded with NOPs not
10 # zeroes when concatenated by the linker.
11 subprocess.check_call(["nacl-gcc", "-c", "tests/section-padding.S",
12 "-o", "tests/section-padding-1.o"])
13 subprocess.check_call(["nacl-gcc", "-c", "tests/section-padding.S",
14 "-Dfoo=foo2",
15 "-o", "tests/section-padding-2.o"])
16 # Use of --relocatable mimics how glibc links libc.so in two
17 # steps, producing libc_pic.os as an intermediate object.
18 subprocess.check_call(["nacl-ld", "--relocatable",
19 "-Lglibc/ld",
20 "tests/section-padding-1.o",
21 "tests/section-padding-2.o",
22 "-o", "tests/section-padding-both.o"])
23 # Link into an .so so that we can run ncval on it.
24 # TODO: Make ncval work on .o files.
25 subprocess.check_call(["nacl-gcc", "-shared",
26 "-Lglibc/ld",
27 "tests/section-padding-both.o",
28 "-o", "tests/section-padding-both.so"])
29 subprocess.check_call(["ncval", "tests/section-padding-both.so"])
32 if __name__ == "__main__":
33 unittest.main()