From 4bb989010711792f3e6286bc1104947d22e4abde Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Thu, 14 Nov 2002 10:17:50 +0000 Subject: [PATCH] Revive all the tests. * boost_build_v2.html: Document new option. * new/generators.jam (find-viable-generators): Revert part of Dave's commit, essentially disabling finding base type generators. This part breaks a test, and need to be thinked about. * new/errors.jam: Handle "--no-error-backtrace" option. * test/project_test4.py: Adjust for new error syntax. [SVN r16233] --- boost_build_v2.html | 13 +++++++--- new/errors.jam | 30 +++++++++++++++++++++++- new/generators.jam | 6 +++-- test/generators-test/Jamfile | 2 +- test/generators-test/extra.jam | 4 ++-- test/generators-test/project-root.jam | 12 +++++----- test/project_test4.py | 8 +++---- v2/boost_build_v2.html | 13 +++++++--- v2/build/generators.jam | 6 +++-- v2/errors.jam | 30 +++++++++++++++++++++++- v2/test/generators-test/Jamfile | 2 +- v2/test/generators-test/extra.jam | 4 ++-- v2/test/generators-test/project-root.jam | 12 +++++----- v2/test/project_test4.py | 8 +++---- 14 files changed, 110 insertions(+), 40 deletions(-) diff --git a/boost_build_v2.html b/boost_build_v2.html index 4f921ea72..83a90d429 100644 --- a/boost_build_v2.html +++ b/boost_build_v2.html @@ -23,9 +23,9 @@ + - build request, build request expansion and directly requested targets + - conditional properties + -->

Cause the project structure to be output. + + + --no-error-backtrace + + Don't print backtrace on errors. Primary usefull for + testing. + diff --git a/new/errors.jam b/new/errors.jam index 3231901b1..1c2a51fc4 100644 --- a/new/errors.jam +++ b/new/errors.jam @@ -102,10 +102,38 @@ rule error-skip-frames ( skip-frames messages * : * ) } } +if --no-error-backtrace in [ modules.peek : ARGV ] +{ + .no-error-backtrace = true ; +} + + # Print an error message with a stack backtrace and exit. rule error ( messages * : * ) { - error-skip-frames 3 $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; + if $(.no-error-backtrace) + { + # Print each argument on a separate line. + for local n in $(.args) + { + if $($(n))-is-not-empty + { + if ! $(first-printed) + { + ECHO error: $($(n)) ; + first-printed = true ; + } + else + { + ECHO $($(n)) ; + } + } + } + } + else + { + error-skip-frames 3 $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; + } } # Print a warning message with a stack backtrace and exit. diff --git a/new/generators.jam b/new/generators.jam index 81f76ac1e..798dac3ae 100644 --- a/new/generators.jam +++ b/new/generators.jam @@ -90,7 +90,7 @@ rule normalize-target-list ( targets ) # Creates a generator rule generator ( id # identifies the generator - should be name of the rule which - # sets up build actions + # sets up build actions : source-types + # types that this generator can handle @@ -565,7 +565,9 @@ local rule find-viable-generators ( target-type : properties * ) local generator-rank = ; import type ; - local t = [ type.all-bases $(target-type) ] ; + #VP: the following breaks the NM transformation test. + #local t = [ type.all-bases $(target-type) ] ; + local t = $(target-type) ; while $(t[1]) { diff --git a/test/generators-test/Jamfile b/test/generators-test/Jamfile index ac002a1c0..d4c3caa98 100644 --- a/test/generators-test/Jamfile +++ b/test/generators-test/Jamfile @@ -6,4 +6,4 @@ exe f : a.cpp b.cxx obj_1 obj_2 lib/auxilliary ; obj obj_1 : z.cpp : SELECT=1 ; obj obj_2 : z.cpp : SELECT=2 ; -nm_exe e : e.cpp ; +nm-exe e : e.cpp ; diff --git a/test/generators-test/extra.jam b/test/generators-test/extra.jam index 5dcec3be7..8a1bffc18 100644 --- a/test/generators-test/extra.jam +++ b/test/generators-test/extra.jam @@ -4,10 +4,10 @@ import generators ; type.register WHL : whl ; type.register DLP : dlp ; -type.register WHL-LR0 : lr0 ; +type.register WHL_LR0 : lr0 ; type.register WD : wd ; -generators.register-standard extra.whale : WHL : CPP WHL-LR0 ; +generators.register-standard extra.whale : WHL : CPP WHL_LR0 ; generators.register-standard extra.dolphin : DLP : CPP ; generators.register-standard extra.wd : WD : WHL(%_parser) DLP(%_lexer) ; diff --git a/test/generators-test/project-root.jam b/test/generators-test/project-root.jam index 5a493cd8e..2bcfd511b 100644 --- a/test/generators-test/project-root.jam +++ b/test/generators-test/project-root.jam @@ -9,7 +9,7 @@ import extra ; import type ; type.register UI : ui ; -type.register UIC-H : h ; +type.register UIC_H : h ; type.register X1 : x1 ; type.register X2 : x2 ; @@ -17,8 +17,8 @@ type.register X_PRO : x_pro ; import generators ; -generators.register-standard qt.uic : UI UIC-H : CPP ; -generators.register-standard qt.uic-h : UI : UIC-H ; +generators.register-standard qt.uic : UI UIC_H : CPP ; +generators.register-standard qt.uic-h : UI : UIC_H ; # That's an interesting example. Currently, X_PRO will be processed # twice. @@ -33,15 +33,15 @@ generators.register-standard extra.x_pro : X_PRO : X1 X2 ; #if $(no-var) { import nm ; -type.register CPP-MARKED : marked.cpp : CPP ; +type.register CPP_MARKED : marked.cpp : CPP ; type.register POSITIONS : positions ; type.register NM.TARGET.CPP : target.cpp : CPP ; type.register NM_EXE : : EXE : main ; # Should inherit generators from base class? generators.register-composing gcc.link : OBJ : NM_EXE : gcc ; -generators.register-standard nm.target-source : CPP-MARKED : NM.TARGET.CPP ; -generators.register-standard nm.cpp-mark : CPP : CPP-MARKED POSITIONS ; +generators.register-standard nm.target-source : CPP_MARKED : NM.TARGET.CPP ; +generators.register-standard nm.cpp-mark : CPP : CPP_MARKED POSITIONS ; rule nm.target.cpp-obj-generator diff --git a/test/project_test4.py b/test/project_test4.py index 70a2c664f..e303d02c0 100644 --- a/test/project_test4.py +++ b/test/project_test4.py @@ -38,12 +38,10 @@ t.expect_content("bin/gcc/debug/main-target-b.exe/b.exe", t.copy("lib/Jamfile2", "lib/Jamfile") -expected="""Requirements for project at 'lib' conflict with parent's. -Explanation: link-incompatible properties single and -multi - +expected="""error: Requirements for project at 'lib' conflict with parent's. +Explanation: link-incompatible properties single and multi """ -t.run_build_system(stdout=expected, status=None) +t.run_build_system("--no-error-backtrace", stdout=expected, status=None) t.copy("lib/Jamfile3", "lib/Jamfile") diff --git a/v2/boost_build_v2.html b/v2/boost_build_v2.html index 4f921ea72..83a90d429 100644 --- a/v2/boost_build_v2.html +++ b/v2/boost_build_v2.html @@ -23,9 +23,9 @@ + - build request, build request expansion and directly requested targets + - conditional properties + -->

Cause the project structure to be output. + + + --no-error-backtrace + + Don't print backtrace on errors. Primary usefull for + testing. + diff --git a/v2/build/generators.jam b/v2/build/generators.jam index 81f76ac1e..798dac3ae 100644 --- a/v2/build/generators.jam +++ b/v2/build/generators.jam @@ -90,7 +90,7 @@ rule normalize-target-list ( targets ) # Creates a generator rule generator ( id # identifies the generator - should be name of the rule which - # sets up build actions + # sets up build actions : source-types + # types that this generator can handle @@ -565,7 +565,9 @@ local rule find-viable-generators ( target-type : properties * ) local generator-rank = ; import type ; - local t = [ type.all-bases $(target-type) ] ; + #VP: the following breaks the NM transformation test. + #local t = [ type.all-bases $(target-type) ] ; + local t = $(target-type) ; while $(t[1]) { diff --git a/v2/errors.jam b/v2/errors.jam index 3231901b1..1c2a51fc4 100644 --- a/v2/errors.jam +++ b/v2/errors.jam @@ -102,10 +102,38 @@ rule error-skip-frames ( skip-frames messages * : * ) } } +if --no-error-backtrace in [ modules.peek : ARGV ] +{ + .no-error-backtrace = true ; +} + + # Print an error message with a stack backtrace and exit. rule error ( messages * : * ) { - error-skip-frames 3 $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; + if $(.no-error-backtrace) + { + # Print each argument on a separate line. + for local n in $(.args) + { + if $($(n))-is-not-empty + { + if ! $(first-printed) + { + ECHO error: $($(n)) ; + first-printed = true ; + } + else + { + ECHO $($(n)) ; + } + } + } + } + else + { + error-skip-frames 3 $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; + } } # Print a warning message with a stack backtrace and exit. diff --git a/v2/test/generators-test/Jamfile b/v2/test/generators-test/Jamfile index ac002a1c0..d4c3caa98 100644 --- a/v2/test/generators-test/Jamfile +++ b/v2/test/generators-test/Jamfile @@ -6,4 +6,4 @@ exe f : a.cpp b.cxx obj_1 obj_2 lib/auxilliary ; obj obj_1 : z.cpp : SELECT=1 ; obj obj_2 : z.cpp : SELECT=2 ; -nm_exe e : e.cpp ; +nm-exe e : e.cpp ; diff --git a/v2/test/generators-test/extra.jam b/v2/test/generators-test/extra.jam index 5dcec3be7..8a1bffc18 100644 --- a/v2/test/generators-test/extra.jam +++ b/v2/test/generators-test/extra.jam @@ -4,10 +4,10 @@ import generators ; type.register WHL : whl ; type.register DLP : dlp ; -type.register WHL-LR0 : lr0 ; +type.register WHL_LR0 : lr0 ; type.register WD : wd ; -generators.register-standard extra.whale : WHL : CPP WHL-LR0 ; +generators.register-standard extra.whale : WHL : CPP WHL_LR0 ; generators.register-standard extra.dolphin : DLP : CPP ; generators.register-standard extra.wd : WD : WHL(%_parser) DLP(%_lexer) ; diff --git a/v2/test/generators-test/project-root.jam b/v2/test/generators-test/project-root.jam index 5a493cd8e..2bcfd511b 100644 --- a/v2/test/generators-test/project-root.jam +++ b/v2/test/generators-test/project-root.jam @@ -9,7 +9,7 @@ import extra ; import type ; type.register UI : ui ; -type.register UIC-H : h ; +type.register UIC_H : h ; type.register X1 : x1 ; type.register X2 : x2 ; @@ -17,8 +17,8 @@ type.register X_PRO : x_pro ; import generators ; -generators.register-standard qt.uic : UI UIC-H : CPP ; -generators.register-standard qt.uic-h : UI : UIC-H ; +generators.register-standard qt.uic : UI UIC_H : CPP ; +generators.register-standard qt.uic-h : UI : UIC_H ; # That's an interesting example. Currently, X_PRO will be processed # twice. @@ -33,15 +33,15 @@ generators.register-standard extra.x_pro : X_PRO : X1 X2 ; #if $(no-var) { import nm ; -type.register CPP-MARKED : marked.cpp : CPP ; +type.register CPP_MARKED : marked.cpp : CPP ; type.register POSITIONS : positions ; type.register NM.TARGET.CPP : target.cpp : CPP ; type.register NM_EXE : : EXE : main ; # Should inherit generators from base class? generators.register-composing gcc.link : OBJ : NM_EXE : gcc ; -generators.register-standard nm.target-source : CPP-MARKED : NM.TARGET.CPP ; -generators.register-standard nm.cpp-mark : CPP : CPP-MARKED POSITIONS ; +generators.register-standard nm.target-source : CPP_MARKED : NM.TARGET.CPP ; +generators.register-standard nm.cpp-mark : CPP : CPP_MARKED POSITIONS ; rule nm.target.cpp-obj-generator diff --git a/v2/test/project_test4.py b/v2/test/project_test4.py index 70a2c664f..e303d02c0 100644 --- a/v2/test/project_test4.py +++ b/v2/test/project_test4.py @@ -38,12 +38,10 @@ t.expect_content("bin/gcc/debug/main-target-b.exe/b.exe", t.copy("lib/Jamfile2", "lib/Jamfile") -expected="""Requirements for project at 'lib' conflict with parent's. -Explanation: link-incompatible properties single and -multi - +expected="""error: Requirements for project at 'lib' conflict with parent's. +Explanation: link-incompatible properties single and multi """ -t.run_build_system(stdout=expected, status=None) +t.run_build_system("--no-error-backtrace", stdout=expected, status=None) t.copy("lib/Jamfile3", "lib/Jamfile")