diff --git a/builder.py b/builder.py
index 2921bab8..0eda461f 100755
a
|
b
|
class SourceFileIfHeaderComposer(SourceFileFragmentComposer): |
505 | 505 | |
506 | 506 | class TestFragementComposer(BuildSystemFragmentComposer): |
507 | 507 | |
508 | | def __init__(self, testName, fileFragments, runTest = True, netTest = False, extraLibs = []): |
| 508 | def __init__(self, testName, fileFragments, configTest = None, runTest = True, netTest = False, extraLibs = []): |
509 | 509 | self.testName = testName |
510 | 510 | self.fileFragments = fileFragments |
| 511 | self.configTest = configTest |
511 | 512 | self.runTest = runTest |
512 | 513 | self.netTest = netTest |
513 | 514 | self.extraLibs = extraLibs |
514 | 515 | |
515 | 516 | def compose(self, path): |
516 | | return ['tests', self.testName, ('default', None)], { 'files': self.fileFragments, |
| 517 | return ['tests', self.testName, ('default', None)], { 'configTest': self.configTest, |
| 518 | 'files': self.fileFragments, |
517 | 519 | 'run': self.runTest, |
518 | 520 | 'net': self.netTest, |
519 | 521 | 'libs': self.extraLibs} |
… |
… |
class TestIfHeaderComposer(TestFragementComposer): |
524 | 526 | if headers is not list: |
525 | 527 | headers = [headers] |
526 | 528 | self.headers = headers |
527 | | super(TestIfHeaderComposer, self).__init__(testName, fileFragments, |
| 529 | super(TestIfHeaderComposer, self).__init__(testName, fileFragments, 'header', |
528 | 530 | runTest = runTest, netTest = netTest, |
529 | 531 | extraLibs = extraLibs) |
530 | 532 | |
… |
… |
class TestIfHeaderComposer(TestFragementComposer): |
539 | 541 | r[0][2] = (define_keys.strip(), self.headers) |
540 | 542 | return r |
541 | 543 | |
| 544 | class TestIfLibraryComposer(TestFragementComposer): |
| 545 | |
| 546 | def __init__(self, testName, libraries, fileFragments, runTest = True, netTest = False, extraLibs = []): |
| 547 | if libraries is not list: |
| 548 | libraries = [libraries] |
| 549 | self.libraries = libraries |
| 550 | super(TestIfLibraryComposer, self).__init__(testName, fileFragments, 'library', |
| 551 | runTest = runTest, netTest = netTest, |
| 552 | extraLibs = extraLibs) |
| 553 | |
| 554 | def compose(self, path): |
| 555 | r = TestFragementComposer.compose(self, path) |
| 556 | define_keys = '' |
| 557 | for l in self.libraries: |
| 558 | l = l.upper() |
| 559 | for c in '\/-.': |
| 560 | l = l.replace(c, '_') |
| 561 | define_keys += ' ' + l |
| 562 | r[0][2] = (define_keys.strip(), self.libraries) |
| 563 | return r |
| 564 | |
542 | 565 | class KVMSymbolsFragmentComposer(BuildSystemFragmentComposer): |
543 | 566 | |
544 | 567 | def compose(self, path): |
… |
… |
class ModuleManager(object): |
857 | 880 | |
858 | 881 | self.generator['source-if-header'] = SourceFileIfHeaderComposer |
859 | 882 | self.generator['test-if-header'] = TestIfHeaderComposer |
| 883 | self.generator['test-if-library'] = TestIfLibraryComposer |
diff --git a/libbsd.py b/libbsd.py
index 3823c03f..c2693e20 100644
a
|
b
|
class tests(builder.Module): |
5278 | 5278 | self.addTest(mm.generator['test']('termios06', ['test_main', |
5279 | 5279 | '../termios/test_termios_driver', |
5280 | 5280 | '../termios/test_termios_utilities'])) |
5281 | | self.addTest(mm.generator['test-if-header']('debugger01', 'rtems/rtems-debugger.h', |
5282 | | ['test_main'], runTest = False, netTest = True, |
| 5281 | self.addTest(mm.generator['test-if-library']('debugger01', 'debugger', |
| 5282 | ['test_main'], runTest = False, netTest = True, |
5283 | 5283 | extraLibs = ['debugger'])) |
5284 | 5284 | self.addTest(mm.generator['test']('crypto01', ['test_main'])) |
5285 | 5285 | self.addTest(mm.generator['test']('ipsec01', ['test_main'])) |
diff --git a/waf_libbsd.py b/waf_libbsd.py
index 84f22b76..c552bef1 100644
a
|
b
|
class Builder(builder.ModuleManager): |
109 | 109 | if config != 'default': |
110 | 110 | if 'configure' not in data: |
111 | 111 | data['configure'] = { } |
112 | | data['configure'][config] = frag[0][2][1] |
| 112 | configTest = frag[1]['configTest'] |
| 113 | if configTest not in data['configure']: |
| 114 | data['configure'][configTest] = { } |
| 115 | data['configure'][configTest][config] = frag[0][2][1] |
113 | 116 | if type(frag[1]) is list: |
114 | 117 | if config not in d[cpu]: |
115 | 118 | d[cpu][config] = [] |
… |
… |
class Builder(builder.ModuleManager): |
149 | 152 | |
150 | 153 | def bsp_configure(self, conf, arch_bsp): |
151 | 154 | if 'configure' in self.data: |
152 | | for cfg in self.data['configure']: |
153 | | for h in self.data['configure'][cfg]: |
154 | | conf.check(header_name = h, |
155 | | features = "c", |
156 | | includes = conf.env.IFLAGS, |
157 | | mandatory = False) |
| 155 | for configTest in self.data['configure']: |
| 156 | for cfg in self.data['configure'][configTest]: |
| 157 | if configTest == 'header': |
| 158 | for h in self.data['configure'][configTest][cfg]: |
| 159 | conf.check(header_name = h, |
| 160 | features = "c", |
| 161 | includes = conf.env.IFLAGS, |
| 162 | mandatory = False) |
| 163 | elif configTest == 'library': |
| 164 | for l in self.data['configure'][configTest][cfg]: |
| 165 | conf.check_cc(lib = l, |
| 166 | linkflags = '-L ' + conf.env.LIBDIR, |
| 167 | mandatory = False) |
| 168 | else: |
| 169 | bld.fatal('invalid config test: %s' % (configTest)) |
| 170 | |
158 | 171 | |
159 | 172 | def build(self, bld): |
160 | 173 | # |