From 48c6c9ed010023695c3534023739fd4448a088ff Mon Sep 17 00:00:00 2001 From: Thibaud Antignac <thibaud.antignac@cea.fr> Date: Mon, 30 Oct 2017 15:18:44 +0100 Subject: [PATCH] Final pass + add oracles to companion archive --- doc/developer/Makefile | 3 +-- doc/developer/tutorial.tex | 2 +- doc/developer/tutorial/hello/Makefile | 9 +++++++++ doc/developer/tutorial/hello/src/hello_test.err.oracle | 0 doc/developer/tutorial/hello/src/hello_test.res.oracle | 3 +++ doc/developer/tutorial/hello/src/print.ml | 7 +++---- doc/developer/tutorial/hello/src/run_print_to_file.ml | 7 +++---- doc/developer/tutorial/hello/src/run_with_options.ml | 7 +++---- 8 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 doc/developer/tutorial/hello/src/hello_test.err.oracle create mode 100644 doc/developer/tutorial/hello/src/hello_test.res.oracle diff --git a/doc/developer/Makefile b/doc/developer/Makefile index 0014db943d2..5af8def8a59 100644 --- a/doc/developer/Makefile +++ b/doc/developer/Makefile @@ -85,8 +85,7 @@ examples/generated/%.ml: examples/%.ml headache -r $@ archives: tutorial/hello/generated - cd tutorial/hello/generated/with_doc/; \ - tar -zcvf ../../../../hello.tar.gz * + cd tutorial/hello/generated/with_doc/ && tar -zcvf ../../../../hello.tar.gz * .PHONY: tutorial/hello/generated tutorial/viewcfg/generated diff --git a/doc/developer/tutorial.tex b/doc/developer/tutorial.tex index d7c6431db96..76223c6ba9d 100644 --- a/doc/developer/tutorial.tex +++ b/doc/developer/tutorial.tex @@ -287,7 +287,7 @@ Visible results of the registration include: \begin{itemize} \item ``hello world'' appears in the list of available plug-ins (consultable with \texttt{frama-c -load-script - hello\_world.ml -help}); + hello\_world.ml -plugins}); \item default options for the plug-in work, including the inline help (available with \texttt{frama-c -load-script hello\_world.ml -hello-help}). diff --git a/doc/developer/tutorial/hello/Makefile b/doc/developer/tutorial/hello/Makefile index 8c4ab461ad4..a4bad5fdb21 100644 --- a/doc/developer/tutorial/hello/Makefile +++ b/doc/developer/tutorial/hello/Makefile @@ -33,6 +33,10 @@ generated/src/tests/hello/%.c: src/%.c cp $< $@ headache -r $< +generated/src/tests/hello/oracle/%.oracle: src/%.oracle + mkdir -p $(dir $@) + cp $< $@ + generated/%/Hello.mli: src/Hello.mli mkdir -p $(dir $@) cp $< $@ @@ -129,6 +133,8 @@ generated/with_doc: generated/src/help_msg.ml \ generated/src/hello_options.doc.ml \ generated/src/hello_print.doc.ml \ generated/src/hello_run.doc.ml \ + generated/src/tests/hello/oracle/hello_test.err.oracle \ + generated/src/tests/hello/oracle/hello_test.res.oracle \ generated/src/Makefile.test mkdir -p $@ cp generated/src/hello_options.doc.ml $@/hello_options.ml @@ -157,6 +163,9 @@ generated/with_doc: generated/src/help_msg.ml \ cat generated/src/extend_run.ml >> $@/hello_run.ml mkdir -p $@/tests/hello cp generated/src/tests/hello/hello_test.c $@/tests/hello/hello_test.c + mkdir -p $@/tests/hello/oracle + cp generated/src/tests/hello/oracle/hello_test.err.oracle $@/tests/hello/oracle/hello_test.err.oracle + cp generated/src/tests/hello/oracle/hello_test.res.oracle $@/tests/hello/oracle/hello_test.res.oracle cp generated/src/Makefile.test $@/Makefile tests: diff --git a/doc/developer/tutorial/hello/src/hello_test.err.oracle b/doc/developer/tutorial/hello/src/hello_test.err.oracle new file mode 100644 index 00000000000..e69de29bb2d diff --git a/doc/developer/tutorial/hello/src/hello_test.res.oracle b/doc/developer/tutorial/hello/src/hello_test.res.oracle new file mode 100644 index 00000000000..9f5bbff5c8f --- /dev/null +++ b/doc/developer/tutorial/hello/src/hello_test.res.oracle @@ -0,0 +1,3 @@ +[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing) +[kernel] Parsing tests/hello/hello_test.c (with preprocessing) +[hello] Hello, world! diff --git a/doc/developer/tutorial/hello/src/print.ml b/doc/developer/tutorial/hello/src/print.ml index 585498d1364..66b338c1642 100644 --- a/doc/developer/tutorial/hello/src/print.ml +++ b/doc/developer/tutorial/hello/src/print.ml @@ -8,7 +8,6 @@ let output msg = Printf.fprintf chan "%s\n" msg; flush chan; close_out chan - with exc -> - let msg = Printexc.to_string exc in - Printf.eprintf "There was an error: %s\n" msg; - raise exc + with Sys_error e -> + let msg = Printexc.to_string (Sys_error e) in + Printf.eprintf "There was an error: %s\n" msg diff --git a/doc/developer/tutorial/hello/src/run_print_to_file.ml b/doc/developer/tutorial/hello/src/run_print_to_file.ml index ae9f3c38983..9392afe31db 100644 --- a/doc/developer/tutorial/hello/src/run_print_to_file.ml +++ b/doc/developer/tutorial/hello/src/run_print_to_file.ml @@ -4,7 +4,6 @@ let run () = Printf.fprintf chan "Hello, world!\n"; flush chan; close_out chan - with exc -> - let msg = Printexc.to_string exc in - Printf.eprintf "There was an error: %s\n" msg; - raise exc + with Sys_error e -> + let msg = Printexc.to_string (Sys_error e) in + Printf.eprintf "There was an error: %s\n" msg diff --git a/doc/developer/tutorial/hello/src/run_with_options.ml b/doc/developer/tutorial/hello/src/run_with_options.ml index 79d9c8cb391..996503022e5 100644 --- a/doc/developer/tutorial/hello/src/run_with_options.ml +++ b/doc/developer/tutorial/hello/src/run_with_options.ml @@ -12,7 +12,6 @@ let run () = close_out chan; in output "Hello, world!" - with exc -> - let msg = Printexc.to_string exc in - Printf.eprintf "There was an error: %s\n" msg; - raise exc + with Sys_error e -> + let msg = Printexc.to_string (Sys_error e) in + Printf.eprintf "There was an error: %s\n" msg -- GitLab