def test(ctx): """Run the felix tests and other commands.""" # Make sure we're built. phases, iscr, felix = build(ctx) from buildsystem.flx import test_flx failed_srcs = [] def test(src): try: passed = test_flx(phases.target, felix, src) except fbuild.ConfigFailed as e: ctx.logger.log(str(e)) passed = False return src, passed # Run the dynamic loading tests first try: lib1 = felix.compile('test/regress/drt/lib1.flx', static=False) lib2 = felix.compile('test/regress/drt/lib2.flx', static=False) except fbuild.ExecutionError as e: ctx.logger.log(e, verbose=1) else: if not test_flx(phases.target, felix, 'test/regress/drt/main1.flx', env={'lib1': lib1, 'lib2': lib2}): failed_srcs.append('test/regress/drt/main1.flx') srcs = Path.globall( 'test/*/*.flx', 'test/*/*/*.flx', 'tut/*/*.flx', exclude=[ 'test/drivers/*.flx', 'test/faio/posix-*.flx', 'test/faio/win-*.flx', 'test/regress/drt/*.flx', 'test/regress/bt/*.flx', 'test/regress/kf/*.flx', 'test/regress/nd/*.flx', 'test/test-data/*.flx', ]) if 'posix' in phases.target.platform: srcs.extend(Path.glob('test/faio/posix-*.flx')) if 'windows' in phases.target.platform: srcs.extend(Path.glob('test/faio/win-*.flx')) for src, passed in phases.target.ctx.scheduler.map( test, sorted(srcs, reverse=True)): if not passed: failed_srcs.append(src) if failed_srcs: ctx.logger.log('\nThe following tests failed:') for src in failed_srcs: ctx.logger.log(' %s' % src, color='yellow')
def __call__(self, dst, srcs: fbuild.db.SRCS, *, libs: fbuild.db.SRCS = (), ldlibs=(), external_libs=(), flags=(), ranlib_flags=(), prefix=None, suffix=None, buildroot=None, **kwargs) -> fbuild.db.DST: buildroot = buildroot or self.ctx.buildroot #libs = set(libs) #libs.update(self.libs) #libs = sorted(libs) #assert srcs or libs, 'no sources passed into ar' assert srcs, 'no sources passed into ar' prefix = prefix or self.prefix suffix = suffix or self.suffix dst = Path(dst).addroot(buildroot) dst = dst.parent / prefix + dst.name + suffix dst.parent.makedirs() srcs = list(Path.globall(srcs)) cmd = [self.exe] cmd.extend(self.flags) cmd.extend(flags) cmd.append(dst) cmd.extend(srcs) #cmd.extend(libs) #cmd.extend(self.external_libs) #cmd.extend(external_libs) self.ctx.execute(cmd, msg1=str(self), msg2='%s -> %s' % (' '.join(srcs), dst), color='link', **kwargs) if self.ranlib is not None: cmd = [self.ranlib] cmd.extend(self.ranlib_flags) cmd.extend(ranlib_flags) cmd.append(dst) self.ctx.execute(cmd, msg1=self.ranlib.name, msg2=dst, color='link', **kwargs) return dst
def build(phase): path = Path('src', 'compiler', 'sex') dypgen = call('buildsystem.dypgen.build_exe', phase) return phase.ocaml.build_lib(path/'sex', Path.globall( path/'*.ml{,i}', dypgen(path/'sex_parse.dyp'), phase.ocamllex(path/'sex_lex.mll')), libs=[ call('buildsystem.ocs.build_lib', phase), call('buildsystem.dypgen.build_lib', phase)])
def build_exe(phase): path = Path('src/compiler/dypgen/dypgen') exe = phase.ocaml.build_exe(path/'dypgen', Path.globall( path/'*.ml{,i}', phase.ocamllex(path/'dypgen_lexer.mll'), phase.ocamllex(path/'extract_type.mll'), phase.ocamllex(path/'insert_linenum.mll')), libs=[build_lib(phase)]) return Builder(phase.ctx, exe)
def build_flx_llvm_backend(phase): path = Path('src/compiler/flx_llvm_backend') return phase.ocaml.build_lib(path / 'flx_llvm_backend', srcs=Path.globall(path / '*.ml{,i}'), includes=[phase.llvm_config.ocaml_libdir()], libs=[ build_flx_misc(phase), build_flx_core(phase), build_flx_backend(phase), ])
def build_flx_lex(phase): path = Path('src/compiler/flx_lex') dypgen = call('buildsystem.dypgen.build_exe', phase) return phase.ocaml.build_lib(path/'flx_lex', srcs=Path.globall(path / '*.ml{,i}'), libs=[ call('buildsystem.dypgen.build_lib', phase), call('buildsystem.ocs.build_lib', phase), call('buildsystem.sex.build', phase), build_flx_version(phase)])
def build_flx_cpp_backend(phase): path = Path('src/compiler/flx_cpp_backend') return phase.ocaml.build_lib(path / 'flx_cpp_backend', srcs=Path.globall( path / '*.ml{,i}',), libs=[ build_flx_misc(phase), build_flx_core(phase), build_flx_frontend(phase), build_flx_backend(phase)], external_libs=['nums'])
def __call__(self, dst, srcs:fbuild.db.SRCS, *, libs:fbuild.db.SRCS=(), ldlibs=(), external_libs=(), flags=(), ranlib_flags=(), prefix=None, suffix=None, buildroot=None, **kwargs) -> fbuild.db.DST: buildroot = buildroot or self.ctx.buildroot #libs = set(libs) #libs.update(self.libs) #libs = sorted(libs) #assert srcs or libs, 'no sources passed into ar' assert srcs, 'no sources passed into ar' prefix = prefix or self.prefix suffix = suffix or self.suffix dst = Path(dst).addroot(buildroot) dst = dst.parent / prefix + dst.name + suffix dst.parent.makedirs() srcs = list(Path.globall(srcs)) cmd = [self.exe] cmd.extend(self.flags) cmd.extend(flags) cmd.append(dst) cmd.extend(srcs) #cmd.extend(libs) #cmd.extend(self.external_libs) #cmd.extend(external_libs) self.ctx.execute(cmd, msg1=str(self), msg2='%s -> %s' % (' '.join(srcs), dst), color='link', **kwargs) if self.ranlib is not None: cmd = [self.ranlib] cmd.extend(self.ranlib_flags) cmd.extend(ranlib_flags) cmd.append(dst) self.ctx.execute(cmd, msg1=self.ranlib.name, msg2=dst, color='link', **kwargs) return dst
def build(phase): path = Path('src', 'compiler', 'sex') dypgen = call('buildsystem.dypgen.build_exe', phase) return phase.ocaml.build_lib(path/'sex', Path.globall( path/'*.ml{,i}', dypgen(path/'sex_parse.dyp'), phase.ocamllex(path/'sex_lex.mll'), exclude=path/'sex.ml'), libs=[ call('buildsystem.ocs.build_lib', phase), call('buildsystem.dypgen.build_lib', phase)])
def build_exe(phase): path = Path('src/compiler/dypgen/dypgen') exe = phase.ocaml.build_exe( path / 'dypgen', Path.globall(path / '*.ml{,i}', phase.ocamllex(path / 'dypgen_lexer.mll'), phase.ocamllex(path / 'extract_type.mll'), phase.ocamllex(path / 'insert_linenum.mll')), libs=[build_lib(phase)]) return Builder(phase.ctx, exe)
def build_flx_lex(phase): path = Path('src/compiler/flx_lex') dypgen = call('buildsystem.dypgen.build_exe', phase) return phase.ocaml.build_lib(path / 'flx_lex', srcs=Path.globall(path / '*.ml{,i}'), libs=[ call('buildsystem.dypgen.build_lib', phase), call('buildsystem.ocs.build_lib', phase), call('buildsystem.sex.build', phase), build_flx_version(phase) ])
def build_flx_cpp_backend(phase): path = Path('src/compiler/flx_cpp_backend') return phase.ocaml.build_lib(path / 'flx_cpp_backend', srcs=Path.globall(path / '*.ml{,i}', ), libs=[ build_flx_lex(phase), build_flx_misc(phase), build_flx_core(phase), build_flx_frontend(phase), build_flx_backend(phase) ], external_libs=[])
def build_flx_parse(phase): path = Path('src/compiler/flx_parse') dypgen = call('buildsystem.dypgen.build_exe', phase) return phase.ocaml.build_lib(path/'flx_parse', srcs=Path.globall( path / '*.ml{,i}', dypgen(path / 'flx_parse.dyp', flags=['--no-undef-nt', '--pv-obj', '--noemit-token-type'])), libs=[ call('buildsystem.dypgen.build_lib', phase), call('buildsystem.ocs.build_lib', phase), call('buildsystem.sex.build', phase), build_flx_version(phase), build_flx_lex(phase)])
def build_flx_parse(phase): path = Path('src/compiler/flx_parse') dypgen = call('buildsystem.dypgen.build_exe', phase) return phase.ocaml.build_lib( path / 'flx_parse', srcs=Path.globall( path / '*.ml{,i}', dypgen(path / 'flx_parse.dyp', flags=['--no-undef-nt', '--pv-obj', '--noemit-token-type'])), libs=[ call('buildsystem.dypgen.build_lib', phase), call('buildsystem.ocs.build_lib', phase), call('buildsystem.sex.build', phase), build_flx_version(phase), build_flx_lex(phase) ])
def build_flx_parse(phase): path = Path('src/compiler/flx_parse') dypgen = call('buildsystem.dypgen.build_exe', phase) return phase.ocaml.build_lib(path/'flx_parse', srcs=Path.globall( path / '*.ml{,i}', dypgen(path / 'flx_parse.dyp', flags=[ '--no-mli', '--no-undef-nt', '--noemit-token-type'])), libs=[ call('buildsystem.dypgen.build_lib', phase), call('buildsystem.ocs.build_lib', phase), build_flx_misc(phase), build_flx_core(phase)], packages=['batteries'])
def build_runtime(phase): path = Path('src/demux') buildsystem.copy_hpps_to_rtl(phase.ctx, #phase.ctx.buildroot / 'config/target/flx_demux_config.hpp', # portable # portable path / 'flx_demux.hpp', path / 'demux_demuxer.hpp', path / 'demux_timer_queue.hpp', path / 'demux_quitter.hpp', # windows (monolithic) path / 'win/demux_iocp_demuxer.hpp', path / 'win/demux_overlapped.hpp', path / 'win/demux_win_timer_queue.hpp', path / 'win/demux_wself_piper.hpp', # posix path / 'posix/demux_posix_demuxer.hpp', path / 'posix/demux_posix_timer_queue.hpp', path / 'posix/demux_pfileio.hpp', path / 'posix/demux_select_demuxer.hpp', path / 'posix/demux_sockety.hpp', path / 'posix/demux_self_piper.hpp', path / 'posix/demux_ts_select_demuxer.hpp', # linux, osx 10.3 (select impl), 10.4 real. path / 'poll/demux_poll_demuxer.hpp', path / 'poll/demux_ts_poll_demuxer.hpp', # linux (>= 2.6) path / 'epoll/demux_epoll_demuxer.hpp', # osx (10.3 onwards)/bsd path / 'kqueue/demux_kqueue_demuxer.hpp', # solaris (9 onwards?) path / 'evtport/demux_evtport_demuxer.hpp', ) dst = 'lib/rtl/demux' srcs = [path / '*.cpp'] includes = [ phase.ctx.buildroot / 'config/target', Path('src', 'pthread'), Path('src', 'gc'), path, ] macros = ['BUILD_DEMUX'] libs = [call('buildsystem.flx_pthread.build_runtime', phase)] extra_libs = [] if 'win32' in phase.platform: print("DEMUX: providing WIN32 IO COMPLETION PORTS"); srcs.extend(( path / 'win/demux_iocp_demuxer.cpp', # windows path / 'win/demux_overlapped.cpp', # windows path / 'win/demux_wself_piper.cpp', # windows path / 'win/demux_win_timer_queue.cpp', # windows )) includes.append(path / 'win') extra_libs.extend(('ws2_32', 'mswsock')) if 'posix' in phase.platform: print("DEMUX: providing POSIX SELECT"); srcs.extend(( path / 'posix/demux_posix_demuxer.cpp', # posix path / 'posix/demux_select_demuxer.cpp', # posix path / 'posix/demux_posix_timer_queue.cpp', # posix path / 'posix/demux_sockety.cpp', # posix path / 'posix/demux_self_piper.cpp', # posix path / 'posix/demux_pfileio.cpp', # posix path / 'posix/demux_ts_select_demuxer.cpp', # posix )) includes.append(path / 'posix') poll_h = config_call('fbuild.config.c.posix.poll_h', phase.platform, phase.cxx.shared) sys_epoll_h = config_call('fbuild.config.c.linux.sys_epoll_h', phase.platform, phase.cxx.shared) sys_event_h = config_call('fbuild.config.c.bsd.sys_event_h', phase.platform, phase.cxx.shared) port_h = config_call('fbuild.config.c.solaris.port_h', phase.platform, phase.cxx.shared) if poll_h.header: print("DEMUX: providing UNIX POLL"); srcs.extend(( # I've seen poll on linux and osx10.4 systems. # conditionally compiled and used. path / 'poll/demux_poll_demuxer.cpp', # I've seen this on linux and osx10.4 path / 'poll/demux_ts_poll_demuxer.cpp', # ditto )) includes.append(path / 'poll') if sys_epoll_h.header: print("DEMUX: providing LINUX EPOLL"); srcs.append(path / 'epoll/demux_epoll_demuxer.cpp') includes.append(path / 'epoll') if sys_event_h.header: print("DEMUX: providing OSX KQUEUE"); srcs.append(path / 'kqueue/demux_kqueue_demuxer.cpp') includes.append(path / 'kqueue') if port_h.header: print("DEMUX: providingd SOLARIS EVENT PORTS"); srcs.append(path / 'evtport/demux_evtport_demuxer.cpp') includes.append(path / 'evtport') srcs = Path.globall(srcs) lp = len (path) #print("demux: srcs = ", [str (src)[lp+1:] for src in srcs]) #print("demux: include paths = ", [str(inc) for inc in includes]) return Record( static=buildsystem.build_cxx_static_lib(phase, dst, srcs, includes=includes, macros=macros, libs=[lib.static for lib in libs], external_libs=extra_libs), shared=buildsystem.build_cxx_shared_lib(phase, dst, srcs, includes=includes, macros=macros, libs=[lib.shared for lib in libs], external_libs=extra_libs))
def build_runtime(phase): path = Path("src/demux") buildsystem.copy_hpps_to_rtl( phase.ctx, # phase.ctx.buildroot / 'lib/rtl/flx_demux_config.hpp', # portable # portable path / "flx_demux.hpp", path / "demux_demuxer.hpp", path / "demux_timer_queue.hpp", path / "demux_quitter.hpp", # windows (monolithic) path / "win/demux_iocp_demuxer.hpp", path / "win/demux_overlapped.hpp", path / "win/demux_win_timer_queue.hpp", path / "win/demux_wself_piper.hpp", # posix path / "posix/demux_posix_demuxer.hpp", path / "posix/demux_posix_timer_queue.hpp", path / "posix/demux_pfileio.hpp", path / "posix/demux_select_demuxer.hpp", path / "posix/demux_sockety.hpp", path / "posix/demux_self_piper.hpp", path / "posix/demux_ts_select_demuxer.hpp", # linux, osx 10.3 (select impl), 10.4 real. path / "poll/demux_poll_demuxer.hpp", path / "poll/demux_ts_poll_demuxer.hpp", # linux (>= 2.6) path / "epoll/demux_epoll_demuxer.hpp", # osx (10.3 onwards)/bsd path / "kqueue/demux_kqueue_demuxer.hpp", # solaris (9 onwards?) path / "evtport/demux_evtport_demuxer.hpp", ) dst = "host/lib/rtl/demux" srcs = [path / "*.cpp"] includes = [phase.ctx.buildroot / "host/lib/rtl", Path("src", "pthread"), Path("src", "gc"), path] macros = ["BUILD_DEMUX"] libs = [call("buildsystem.flx_pthread.build_runtime", phase)] extra_libs = [] if "win32" in phase.platform: print("DEMUX: providing WIN32 IO COMPLETION PORTS") srcs.extend( ( path / "win/demux_iocp_demuxer.cpp", # windows path / "win/demux_overlapped.cpp", # windows path / "win/demux_wself_piper.cpp", # windows path / "win/demux_win_timer_queue.cpp", # windows ) ) includes.append(path / "win") extra_libs.extend(("ws2_32", "mswsock")) if "posix" in phase.platform: print("DEMUX: providing POSIX SELECT") srcs.extend( ( path / "posix/demux_posix_demuxer.cpp", # posix path / "posix/demux_select_demuxer.cpp", # posix path / "posix/demux_posix_timer_queue.cpp", # posix path / "posix/demux_sockety.cpp", # posix path / "posix/demux_self_piper.cpp", # posix path / "posix/demux_pfileio.cpp", # posix path / "posix/demux_ts_select_demuxer.cpp", # posix ) ) includes.append(path / "posix") poll_h = config_call("fbuild.config.c.posix.poll_h", phase.platform, phase.cxx.shared) sys_epoll_h = config_call("fbuild.config.c.linux.sys_epoll_h", phase.platform, phase.cxx.shared) sys_event_h = config_call("fbuild.config.c.bsd.sys_event_h", phase.platform, phase.cxx.shared) port_h = config_call("fbuild.config.c.solaris.port_h", phase.platform, phase.cxx.shared) if poll_h.header: print("DEMUX: providing UNIX POLL") srcs.extend( ( # I've seen poll on linux and osx10.4 systems. # conditionally compiled and used. path / "poll/demux_poll_demuxer.cpp", # I've seen this on linux and osx10.4 path / "poll/demux_ts_poll_demuxer.cpp", # ditto ) ) includes.append(path / "poll") if sys_epoll_h.header: print("DEMUX: providing LINUX EPOLL") srcs.append(path / "epoll/demux_epoll_demuxer.cpp") includes.append(path / "epoll") if sys_event_h.header: print("DEMUX: providing OSX KQUEUE") srcs.append(path / "kqueue/demux_kqueue_demuxer.cpp") includes.append(path / "kqueue") if port_h.header: print("DEMUX: providingd SOLARIS EVENT PORTS") srcs.append(path / "evtport/demux_evtport_demuxer.cpp") includes.append(path / "evtport") srcs = Path.globall(srcs) lp = len(path) # print("demux: srcs = ", [str (src)[lp+1:] for src in srcs]) # print("demux: include paths = ", [str(inc) for inc in includes]) return Record( static=buildsystem.build_cxx_static_lib( phase, dst, srcs, includes=includes, macros=macros, libs=[lib.static for lib in libs], external_libs=extra_libs, ), shared=buildsystem.build_cxx_shared_lib( phase, dst, srcs, includes=includes, macros=macros, libs=[lib.shared for lib in libs], external_libs=extra_libs, ), )
def build_runtime(phase): path = Path('src/demux') buildsystem.copy_hpps_to_rtl(phase.ctx, #phase.ctx.buildroot / 'lib/rtl/flx_demux_config.hpp', # portable # portable path / 'flx_demux.hpp', path / 'demux_demuxer.hpp', path / 'demux_timer_queue.hpp', path / 'demux_quitter.hpp', # windows (monolithic) path / 'win/demux_iocp_demuxer.hpp', path / 'win/demux_overlapped.hpp', path / 'win/demux_win_timer_queue.hpp', path / 'win/demux_wself_piper.hpp', # posix path / 'posix/demux_posix_demuxer.hpp', path / 'posix/demux_posix_timer_queue.hpp', path / 'posix/demux_pfileio.hpp', path / 'posix/demux_select_demuxer.hpp', path / 'posix/demux_sockety.hpp', path / 'posix/demux_self_piper.hpp', path / 'posix/demux_ts_select_demuxer.hpp', # linux, osx 10.3 (select impl), 10.4 real. path / 'poll/demux_poll_demuxer.hpp', path / 'poll/demux_ts_poll_demuxer.hpp', # linux (>= 2.6) path / 'epoll/demux_epoll_demuxer.hpp', # osx (10.3 onwards)/bsd path / 'kqueue/demux_kqueue_demuxer.hpp', # solaris (9 onwards?) path / 'evtport/demux_evtport_demuxer.hpp', ) dst = 'host/lib/rtl/demux' srcs = [path / '*.cpp'] includes = [ phase.ctx.buildroot / 'host/lib/rtl', Path('src', 'pthread'), Path('src', 'gc'), path, ] macros = ['BUILD_DEMUX'] libs = [call('buildsystem.flx_pthread.build_runtime', phase)] extra_libs = [] if 'win32' in phase.platform: print("DEMUX: providing WIN32 IO COMPLETION PORTS"); srcs.extend(( path / 'win/demux_iocp_demuxer.cpp', # windows path / 'win/demux_overlapped.cpp', # windows path / 'win/demux_wself_piper.cpp', # windows path / 'win/demux_win_timer_queue.cpp', # windows )) includes.append(path / 'win') extra_libs.extend(('ws2_32', 'mswsock')) if 'posix' in phase.platform: print("DEMUX: providing POSIX SELECT"); srcs.extend(( path / 'posix/demux_posix_demuxer.cpp', # posix path / 'posix/demux_select_demuxer.cpp', # posix path / 'posix/demux_posix_timer_queue.cpp', # posix path / 'posix/demux_sockety.cpp', # posix path / 'posix/demux_self_piper.cpp', # posix path / 'posix/demux_pfileio.cpp', # posix path / 'posix/demux_ts_select_demuxer.cpp', # posix )) includes.append(path / 'posix') poll_h = config_call('fbuild.config.c.posix.poll_h', phase.platform, phase.cxx.shared) sys_epoll_h = config_call('fbuild.config.c.linux.sys_epoll_h', phase.platform, phase.cxx.shared) sys_event_h = config_call('fbuild.config.c.bsd.sys_event_h', phase.platform, phase.cxx.shared) port_h = config_call('fbuild.config.c.solaris.port_h', phase.platform, phase.cxx.shared) if poll_h.header: print("DEMUX: providing UNIX POLL"); srcs.extend(( # I've seen poll on linux and osx10.4 systems. # conditionally compiled and used. path / 'poll/demux_poll_demuxer.cpp', # I've seen this on linux and osx10.4 path / 'poll/demux_ts_poll_demuxer.cpp', # ditto )) includes.append(path / 'poll') if sys_epoll_h.header: print("DEMUX: providing LINUX EPOLL"); srcs.append(path / 'epoll/demux_epoll_demuxer.cpp') includes.append(path / 'epoll') if sys_event_h.header: print("DEMUX: providing OSX KQUEUE"); srcs.append(path / 'kqueue/demux_kqueue_demuxer.cpp') includes.append(path / 'kqueue') if port_h.header: print("DEMUX: providingd SOLARIS EVENT PORTS"); srcs.append(path / 'evtport/demux_evtport_demuxer.cpp') includes.append(path / 'evtport') srcs = Path.globall(srcs) lp = len (path) #print("demux: srcs = ", [str (src)[lp+1:] for src in srcs]) #print("demux: include paths = ", [str(inc) for inc in includes]) return Record( static=buildsystem.build_cxx_static_lib(phase, dst, srcs, includes=includes, macros=macros, libs=[lib.static for lib in libs], external_libs=extra_libs), shared=buildsystem.build_cxx_shared_lib(phase, dst, srcs, includes=includes, macros=macros, libs=[lib.shared for lib in libs], external_libs=extra_libs))
def unit_tests(): """Returns the felix unit tests""" return Path.globall( 'tests/flxi/*.flx', 'tests/parser/*.flx')
def test(ctx): """Run the felix tests and other commands.""" # Make sure we're built. phases, iscr, felix = build(ctx) from buildsystem.flx import test_flx, compile_flx failed = [] def test(src): try: passed = test_flx(phases.target, felix, src) except fbuild.ConfigFailed as e: ctx.logger.log(str(e)) passed = False return src, passed def test_compile(src): try: passed = compile_flx(phases.target, felix, src) except fbuild.ConfigFailed as e: ctx.logger.log(str(e)) passed = False return src, passed # Run the dynamic loading tests first ctx.logger.log("\nRunning dynamic loading tests\n", color='red') try: lib1 = felix.compile('test/regress/drt/lib1.flx', static=False) lib2 = felix.compile('test/regress/drt/lib2.flx', static=False) print("lib1="+lib1) print("lib2="+lib2) except fbuild.ExecutionError as e: ctx.logger.log(e, verbose=1) else: if not test_flx(phases.target, felix, 'test/regress/drt/main1.flx', env={'lib1': lib1, 'lib2': lib2}): failed.append('test/regress/drt/main1.flx') srcs = [ # CORE ('regress_rt' , Path.globall('test/regress/rt/*.flx')), ('regress_nd' , Path.globall('test/regress/nd/*.flx')), ('regress_stl' , Path.globall('test/regress/stl/*.flx')), ('tut_embedding' , Path.globall('tut/embedding/*.flx')), ('tut_migration', Path.globall('tut/migration/*.flx')), ('tut_tutorial', Path.globall('tut/tutorial/*.flx')), ('collection' , Path.globall('test/collection/*.flx')), #('drivers' , Path.globall('test/drivers/*.flx')), ('glob' , Path.globall('test/glob/*.flx')), ('judy' , Path.globall('test/judy/*.flx')), ('sqlite3' , Path.globall('test/sqlite/*.flx')), ('pthread' , Path.globall('test/pthread/*.flx')), ('stdlib' , Path.globall('test/stdlib/*.flx')), ('tre' , Path.globall('test/tre/*.flx')), ('web' , Path.globall('test/web/*.flx',exclude=['test/web/xml2-*.flx'])), # ASYNC I/O ('faio',Path.globall('test/faio/*.flx',exclude=['test/faio/posix-*.flx','test/faio/win-*.flx'])), ] gmp_h = config_call( 'fbuild.config.c.gmp.gmp_h', phases.target.platform, phases.target.c.static).header if gmp_h: ctx.logger.log("gmp supported",color='green') else: ctx.logger.log("gmp NOT supported",color='red') mman_h = config_call( 'fbuild.config.c.posix04.sys_mman_h', phases.target.platform, phases.target.c.static).header if mman_h: ctx.logger.log("mmap supported",color='green') else: ctx.logger.log("mmap NOT supported",color='red') libxml2_libxml_xmlexports_h = config_call( 'fbuild.config.c.xml2.libxml2_libxml_xmlexports_h', phases.target.platform, phases.target.c.static).header if libxml2_libxml_xmlexports_h: ctx.logger.log("libxml2 supported",color='green') else: ctx.logger.log("libxml2 NOT supported",color='red') zmq_h = config_call( 'fbuild.config.c.zmq.zmq_h', phases.target.platform, phases.target.c.static).header if zmq_h: ctx.logger.log("zmq supported",color='green') else: ctx.logger.log("zmq NOT supported",color='red') osrcs = [ # EXTERNAL LIBS ('windows' in phases.target.platform,'faio_win', Path.globall('test/faio/win-*.flx')), ('posix' in phases.target.platform, 'faio_posix', Path.globall('test/faio/posix-*.flx')), (gmp_h,'gmp', Path.globall('test/gmp/*.flx')), (mman_h,'mmap', Path.globall('test/mmap/*.flx')), (libxml2_libxml_xmlexports_h,'xml2', Path.globall('test/web/xml2-*flx')), ] osrcs_compileonly = [ (zmq_h,'zmq', Path.globall('test/zmq/*.flx')), ] #-------------------------------- ctx.logger.log("\nRunning core tests\n", color='cyan') for name,paths in srcs: failed_srcs = [] ctx.logger.log("Running test "+name, color='cyan') for src, passed in phases.target.ctx.scheduler.map( test, sorted(paths, reverse=True)): if not passed: failed_srcs.append(src) failed.append(src) if failed_srcs: ctx.logger.log('\nOf '+str (len (paths))+' tests') ctx.logger.log('\nThe following tests failed:') for src in failed_srcs: ctx.logger.log(' %s' % src, color='yellow') else: ctx.logger.log('All ' + str (len (paths))+' tests passed', color='cyan') ctx.logger.log("\nRunning optional tests\n", color='cyan') for flag,name,paths in osrcs: if flag: failed_srcs = [] ctx.logger.log("Running test "+name, color='cyan') for src, passed in phases.target.ctx.scheduler.map( test, sorted(paths, reverse=True)): if not passed: failed_srcs.append(src) failed.append(src) if failed_srcs: ctx.logger.log('\nOf '+str (len (paths))+' tests') ctx.logger.log('\nThe following tests failed:') for src in failed_srcs: ctx.logger.log(' %s' % src, color='yellow') else: ctx.logger.log('All ' + str (len (paths))+' tests passed', color='cyan') else: ctx.logger.log("SKIPPING test "+name+" resource not availabe", color='red') ctx.logger.log("\nRunning optional compiler only tests\n", color='cyan') for flag,name,paths in osrcs_compileonly: if flag: failed_srcs = [] ctx.logger.log("Compiling test "+name, color='cyan') for src, passed in phases.target.ctx.scheduler.map( test_compile, sorted(paths, reverse=True)): if not passed: failed_srcs.append(src) failed.append(src) if failed_srcs: ctx.logger.log('\nOf '+str (len (paths))+' tests') ctx.logger.log('\nThe following tests failed:') for src in failed_srcs: ctx.logger.log(' %s' % src, color='yellow') else: ctx.logger.log('All ' + str (len (paths))+' tests passed', color='cyan') else: ctx.logger.log("SKIPPING test "+name+" resource not availabe", color='red') if failed: ctx.logger.log('\n======================================') ctx.logger.log('\nThe following tests failed:') for src in failed: ctx.logger.log(' %s' % src, color='yellow')