From 4f841757b84ddb2cf844252633dc2403569aa066 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 29 Aug 2018 15:41:07 +0200 Subject: Add unit-tests option to bdep-new If specified (-t exe,unit-tests or -t lib,unit-tests) then generate build infrastructure for unit testing. --- tests/ci.test | 2 +- tests/config.test | 2 +- tests/fetch.test | 2 +- tests/init.test | 2 +- tests/new.test | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++--- tests/publish.test | 2 +- tests/status.test | 2 +- tests/sync.test | 2 +- tests/test.test | 2 +- tests/update.test | 2 +- 10 files changed, 79 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/ci.test b/tests/ci.test index 85155de..ed6f0c0 100644 --- a/tests/ci.test +++ b/tests/ci.test @@ -50,7 +50,7 @@ repository='http://example.com/prj.git' test.arguments += --yes --repository "$repository" --server "$server" \ --simulate 'success' -cxx = cc "config.cxx=$config.cxx" +cxx = cc config.cxx="$recall($cxx.path)" new += 2>! init += $cxx -d prj 2>! &prj/**/bootstrap/*** diff --git a/tests/config.test b/tests/config.test index 3dcd9f6..0500686 100644 --- a/tests/config.test +++ b/tests/config.test @@ -7,7 +7,7 @@ .include common.test project.test -cxx = cc "config.cxx=$config.cxx" +cxx = cc config.cxx="$recall($cxx.path)" status += -d prj init += -d prj diff --git a/tests/fetch.test b/tests/fetch.test index 0d0c1bc..d97bf63 100644 --- a/tests/fetch.test +++ b/tests/fetch.test @@ -4,7 +4,7 @@ .include common.test project.test -cxx = cc "config.cxx=$config.cxx" +cxx = cc config.cxx="$recall($cxx.path)" new += 2>! init += $cxx -d prj 2>! diff --git a/tests/init.test b/tests/init.test index 28f66e2..6214985 100644 --- a/tests/init.test +++ b/tests/init.test @@ -7,7 +7,7 @@ .include common.test project.test -cxx = cc "config.cxx=$config.cxx" +cxx = cc config.cxx="$recall($cxx.path)" status += -d prj deinit += -d prj diff --git a/tests/new.test b/tests/new.test index 6ae37e4..ee53668 100644 --- a/tests/new.test +++ b/tests/new.test @@ -8,7 +8,8 @@ # test.arguments += --no-checks -cxx = "config.cxx=$config.cxx" +c = config.c="$recall($c.path)" +cxx = config.cxx="$recall($cxx.path)" status += -d prj @@ -21,7 +22,7 @@ status += -d prj : exe { - $* --no-amalgamation -t exe -l c++ prj-foo 2>>/"EOE" &prj-foo/***; + $* -t exe -l c++ prj-foo 2>>/"EOE" &prj-foo/***; created new executable project prj-foo in $~/prj-foo/ EOE @@ -30,9 +31,20 @@ status += -d prj EOE } + : exe-c + { + $* -t exe -l c prj-foo 2>>/"EOE" &prj-foo/***; + created new executable project prj-foo in $~/prj-foo/ + EOE + + $build prj-foo/ $c 2>>~%EOE% + %(c|ld) .+%{2} + EOE + } + : lib { - $* --no-amalgamation -t lib -l c++ libprj-foo 2>>/"EOE" &libprj-foo/***; + $* -t lib -l c++ libprj-foo 2>>/"EOE" &libprj-foo/***; created new library project libprj-foo in $~/libprj-foo/ EOE @@ -41,6 +53,61 @@ status += -d prj EOE } + : lib-c + { + $* -t lib -l c libprj-foo 2>>/"EOE" &libprj-foo/***; + created new library project libprj-foo in $~/libprj-foo/ + EOE + + $build libprj-foo/ $c 2>>~%EOE% + %(version\.in|c|ar|ld) .+%{7} + EOE + } + + : exe-unit-tests + { + $* -t exe,unit-tests -l c++ foo 2>>/"EOE" &foo/***; + created new executable project foo in $~/foo/ + EOE + + $build foo/ $cxx 2>>~%EOE% + %(c\+\+|ld|ar) .+%{5} + EOE + } + + : exe-c-unit-tests + { + $* -t exe,unit-tests -l c foo 2>>/"EOE" &foo/***; + created new executable project foo in $~/foo/ + EOE + + $build foo/ $c 2>>~%EOE% + %(c|ld|ar) .+%{5} + EOE + } + + : lib-unit-tests + { + $* -t lib,unit-tests -l c++ libfoo 2>>/"EOE" &libfoo/***; + created new library project libfoo in $~/libfoo/ + EOE + + $build libfoo/ $cxx 2>>~%EOE% + %(version\.in|c\+\+|ar|ld) .+%{11} + EOE + } + + : lib-c-unit-tests + { + $* -t lib,unit-tests -l c libfoo 2>>/"EOE" &libfoo/***; + created new library project libfoo in $~/libfoo/ + EOE + + $build libfoo/ $c 2>>~%EOE% + %(version\.in|c|ar|ld) .+%{11} + EOE + } + : pkg : { diff --git a/tests/publish.test b/tests/publish.test index ba88e9a..0861931 100644 --- a/tests/publish.test +++ b/tests/publish.test @@ -30,7 +30,7 @@ end test.arguments += --repository "$repository" --yes \ --author-name user --author-email user@example.com -cxx = cc "config.cxx=$config.cxx" +cxx = cc config.cxx="$recall($cxx.path)" new += 2>! init += $cxx -d prj 2>! &prj/**/bootstrap/*** diff --git a/tests/status.test b/tests/status.test index 676dac0..2d60af5 100644 --- a/tests/status.test +++ b/tests/status.test @@ -4,7 +4,7 @@ .include common.test project.test -cxx = cc "config.cxx=$config.cxx" +cxx = cc config.cxx="$recall($cxx.path)" new += 2>! init += $cxx -d prj 2>! diff --git a/tests/sync.test b/tests/sync.test index b297990..4872f11 100644 --- a/tests/sync.test +++ b/tests/sync.test @@ -4,7 +4,7 @@ .include common.test -cxx = cc "config.cxx=$config.cxx" +cxx = cc config.cxx="$recall($cxx.path)" new += 2>! init += $cxx -d prj 2>! diff --git a/tests/test.test b/tests/test.test index 4ee43e0..667ee7a 100644 --- a/tests/test.test +++ b/tests/test.test @@ -4,7 +4,7 @@ .include common.test -cxx = cc "config.cxx=$config.cxx" +cxx = cc config.cxx="$recall($cxx.path)" new += 2>! init += cc "config.cxx=$config.cxx" -d prj 2>! diff --git a/tests/update.test b/tests/update.test index ed4bbd2..12be96e 100644 --- a/tests/update.test +++ b/tests/update.test @@ -7,7 +7,7 @@ .include common.test -cxx = cc "config.cxx=$config.cxx" +cxx = cc config.cxx="$recall($cxx.path)" new += 2>! init += $cxx -d prj 2>! -- cgit v1.1