From dd973d03bf5f3f439dcdacbb22470105e66e698a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 29 Mar 2017 00:45:30 +0300 Subject: Implement manifests and build_config --- tests/buildtab/buildfile | 9 +++++++ tests/buildtab/driver.cxx | 48 ++++++++++++++++++++++++++++++++++++ tests/buildtab/testscript | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 tests/buildtab/buildfile create mode 100644 tests/buildtab/driver.cxx create mode 100644 tests/buildtab/testscript (limited to 'tests/buildtab') diff --git a/tests/buildtab/buildfile b/tests/buildtab/buildfile new file mode 100644 index 0000000..f156dbf --- /dev/null +++ b/tests/buildtab/buildfile @@ -0,0 +1,9 @@ +# file : tests/buildtab/buildfile +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +import libs += libbutl%lib{butl} + +exe{driver}: cxx{driver} ../../bbot/lib{bbot} $libs test{testscript} + +include ../../bbot/ diff --git a/tests/buildtab/driver.cxx b/tests/buildtab/driver.cxx new file mode 100644 index 0000000..c3e3a60 --- /dev/null +++ b/tests/buildtab/driver.cxx @@ -0,0 +1,48 @@ +// file : tests/buildtab/driver.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include // ios::failbit, ios::badbit +#include +#include + +#include // operator<<(ostream,exception) + +#include + +using namespace std; +using namespace butl; +using namespace bbot; + +// Usage: argv[0] +// +// Read and parse buildtab from STDIN and serialize the resulted build +// configuration to STDOUT. +// +int +main () +try +{ + cin.exceptions (ios::failbit | ios::badbit); + cout.exceptions (ios::failbit | ios::badbit); + + for (const auto& c: parse_buildtab (cin, "cin")) + { + cout << c.machine_pattern << ' ' << c.name; + + if (c.target) + cout << ' ' << *c.target; + + for (const auto& v: c.vars) + cout << ' ' << v; + + cout << '\n'; + } + + return 0; +} +catch (const tab_parsing& e) +{ + cerr << e << endl; + return 1; +} diff --git a/tests/buildtab/testscript b/tests/buildtab/testscript new file mode 100644 index 0000000..5bf6b24 --- /dev/null +++ b/tests/buildtab/testscript @@ -0,0 +1,63 @@ +# file : tests/buildtab/testscript +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +: valid +: +: Roundtrip buildtab. +: +{ + : all-fileds-combinations + : + $* <>EOF + windows*-vc_14* windows-vc_14 + windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0 + windows*-vc_14* windows-vc_14debug config.cc.coptions=/Z7 config.cc.loptions=/DEBUG + windows*-vc_14* windows-vc_14-32-debug i686-microsoft-win32-msvc14.0 config.cc.coptions=/Z7 config.cc.loptions=/DEBUG + EOF + + : empty-lines + : + $* <>EOO + + windows*-vc_14* windows-vc_14-32-debug + # abc + EOI + windows*-vc_14* windows-vc_14-32-debug + EOO +} + +: parse-errors +: +{ + : no-name + : + $* <>EOE == 1 + windows*-vc_14* + EOI + cin:1:16: error: no configuration name found + EOE + + : invalid-target + : + $* <>EOE == 1 + windows*-vc_14* windows-vc_14-32 microsoft + EOI + cin:1:34: error: missing cpu + EOE + + : invalid-var + : + $* <>EOE == 1 + windows*-vc_14* windows-vc_14-32 config.cc.coptions="/Z7 + EOI + cin:1:57: error: unterminated quoted string + EOE + + : dup-config-name + : + $* <'cin:2:17: error: duplicate configuration name' == 1 + windows*-vc_14* windows-vc_14-32 + windows*-vc_14* windows-vc_14-32 i686-microsoft-win32-msvc14.0 + EOI +} -- cgit v1.1