• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""Tests for compiler_wrapper."""
2
3from __future__ import print_function
4
5import unittest
6
7import compiler_wrapper
8
9
10class CompilerWrapperTest(unittest.TestCase):
11
12  def testFilterZDefs(self):
13    self.assertListEqual(
14        ['arg'],
15        compiler_wrapper.RemoveZDefs(['arg', '-Wl,-z,defs']))
16
17    self.assertListEqual(
18        ['arg'],
19        compiler_wrapper.RemoveZDefs(['arg', '-Wl,-z,--no-undefined']))
20
21    self.assertListEqual(
22        ['arg', '-Wl,-z,relro'],
23        compiler_wrapper.RemoveZDefs(['arg', '-Wl,-z,relro']))
24
25    self.assertListEqual(
26        ['arg', '-Wl,-soname,lib.so.1,-z,relro'],
27        compiler_wrapper.RemoveZDefs(['arg', '-Wl,-soname,lib.so.1,-z,defs,-z,relro']))
28
29    self.assertListEqual(
30        ['arg', '-Wl,-z,relro'],
31        compiler_wrapper.RemoveZDefs(['arg', '-Wl,-z,relro,-z,defs']))
32
33    self.assertListEqual(
34        ['arg'],
35        compiler_wrapper.RemoveZDefs(['arg', '-Wl,-z', '-Wl,defs']))
36
37    self.assertListEqual(
38        ['arg', 'arg2'],
39        compiler_wrapper.RemoveZDefs(['arg', '-Wl,-z', 'arg2', '-Wl,--no-undefined']))
40
41if __name__ == '__main__':
42  unittest.main()
43