From aada7342f19f87ab77ec7a39ccbec7ae543b3941 Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:45:00 -0500 Subject: [PATCH 1/9] Slide 55 (Command Line Example Run): words chopped off edge of slide --- courses/gnatsas/check_020_getting_started.rst | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/courses/gnatsas/check_020_getting_started.rst b/courses/gnatsas/check_020_getting_started.rst index 711d37dca..385bfd506 100644 --- a/courses/gnatsas/check_020_getting_started.rst +++ b/courses/gnatsas/check_020_getting_started.rst @@ -99,24 +99,24 @@ Command Line Example Run :command:`gnatcheck -P simple.gpr -rules -from=coding_standard.rules` -:: - - chop.adb:14:11: PIck_Up does not have casing specified (mixed) - chop.ads:11:18: Stick does not start with subtype prefix T_ - phil.adb:21:11: Think_Times does not start with subtype prefix T_ - phil.adb:33:05: "Who_Am_I" is not modified, could be declared constant - phil.ads:12:03: violation of restriction "No_Tasking" - phil.ads:12:13: Philosopher does not start with subtype prefix T_ - phil.ads:12:26: My_ID does not have casing specified (mixed) - phil.ads:19:08: States does not end with type suffix _Type - phil.ads:19:08: States does not start with subtype prefix T_ - random_generic.ads:5:08: Result_Subtype does not end with type suffix _Type - random_generic.ads:5:08: Result_Subtype does not start with subtype prefix T_ - room.adb:19:03: violation of restriction "No_Tasking" - room.adb:19:23: anonymous subtype - ... - -.. container:: latex_environment footnotesize +.. container:: latex_environment scriptsize + + .. code:: output + + chop.adb:14:11: PIck_Up does not have casing specified (mixed) + chop.ads:11:18: Stick does not start with subtype prefix T_ + phil.adb:21:11: Think_Times does not start with subtype prefix T_ + phil.adb:33:05: "Who_Am_I" is not modified, could be declared constant + phil.ads:12:03: violation of restriction "No_Tasking" + phil.ads:12:13: Philosopher does not start with subtype prefix T_ + phil.ads:12:26: My_ID does not have casing specified (mixed) + phil.ads:19:08: States does not end with type suffix _Type + phil.ads:19:08: States does not start with subtype prefix T_ + random_generic.ads:5:08: Result_Subtype does not end with type suffix _Type + random_generic.ads:5:08: Result_Subtype does not start with subtype prefix T_ + room.adb:19:03: violation of restriction "No_Tasking" + room.adb:19:23: anonymous subtype + ... *These messages are coming from rules specified in* :filename:`coding_standard.rules` From 67b54cbb9baa103280cccb068cac25632af0fe7d Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:26:53 -0500 Subject: [PATCH 2/9] Slide 86 (Mapping Python API to LKQL API): Potentially add LKQL LAL API link Removed line because link is appears two pages earlier --- courses/gnatsas/check_040_lkql.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/courses/gnatsas/check_040_lkql.rst b/courses/gnatsas/check_040_lkql.rst index 9e81b74f1..d04db5cb5 100644 --- a/courses/gnatsas/check_040_lkql.rst +++ b/courses/gnatsas/check_040_lkql.rst @@ -219,8 +219,6 @@ Mapping Python API to LKQL API val expr_types = [node.p_expression_type() for node in select Expr] -In the future LKQL will have its own LAL API documentation. - ------------------------------- Integrating LKQL in GNATcheck ------------------------------- From 0514039dcff1f84112521e542f7697c303c8abdf Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:32:57 -0500 Subject: [PATCH 3/9] Slide 124 (GNAT SAS in a Nutshell (2/2)): "runtime" and "run-time" used According to chatgpt, "runtime" is the preferred choice --- courses/gnatsas/sas_010_introduction.rst | 2 +- courses/gnatsas/sas_020_overview.rst | 8 ++++---- courses/gnatsas/sas_040_viewing_results.rst | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/courses/gnatsas/sas_010_introduction.rst b/courses/gnatsas/sas_010_introduction.rst index de6284789..f00974458 100644 --- a/courses/gnatsas/sas_010_introduction.rst +++ b/courses/gnatsas/sas_010_introduction.rst @@ -74,7 +74,7 @@ Why Use :toolname:`GNAT SAS`? + Efficient automated code reviewer - + Identifies run-time errors with a **level of certainty** + + Identifies runtime errors with a **level of certainty** + E.g. buffer overflows, division by zero diff --git a/courses/gnatsas/sas_020_overview.rst b/courses/gnatsas/sas_020_overview.rst index 5bda04f8a..f65a4abae 100644 --- a/courses/gnatsas/sas_020_overview.rst +++ b/courses/gnatsas/sas_020_overview.rst @@ -104,7 +104,7 @@ GNAT SAS in a Nutshell (2/2) + Detects runtime and logic errors - + Initialization errors, run-time errors and assertion failures + + Initialization errors, runtime errors and assertion failures + Race condition errors: unprotected access to globals + Warns on dead or suspicious code @@ -128,8 +128,8 @@ Integrated Analysis Engines + Inspector - + Excels in detecting possibly failing run-time checks as well as wide range of logical errors - + Determines preconditions on the inputs necessary to preclude run-time failures + + Excels in detecting possibly failing runtime checks as well as wide range of logical errors + + Determines preconditions on the inputs necessary to preclude runtime failures + Makes presumptions about return values of external subprograms + Identifies postconditions that characterize the range of outputs @@ -143,7 +143,7 @@ Integrated Analysis Engines + GNAT Warnings + Provides warning issued by GNAT compiler frontend - + Detects things like suspicious constructs and warnings when the compiler is sure an exception will be raised at run-time + + Detects things like suspicious constructs and warnings when the compiler is sure an exception will be raised at runtime + GNATcheck diff --git a/courses/gnatsas/sas_040_viewing_results.rst b/courses/gnatsas/sas_040_viewing_results.rst index 547872d7c..9b1722740 100644 --- a/courses/gnatsas/sas_040_viewing_results.rst +++ b/courses/gnatsas/sas_040_viewing_results.rst @@ -105,7 +105,7 @@ Message Kinds * Message kinds fall into one of the following categories * Warning - compilation warnings issued by GNAT front end - * Check - possible run-time check failures + * Check - possible runtime check failures * Informational - extra information about a message * Race Condition - messages about synchronization objects * Annotation - Information about a subprogram determined by analysis From df35d2ef11bfcb853a305224b8a4620f7130beda Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:37:47 -0500 Subject: [PATCH 4/9] Page 192 - need to add GNATfuzz to list of GNAT DAS components --- courses/gnatdas/010_overview.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/courses/gnatdas/010_overview.rst b/courses/gnatdas/010_overview.rst index 44bfd6a16..d8a37b249 100644 --- a/courses/gnatdas/010_overview.rst +++ b/courses/gnatdas/010_overview.rst @@ -65,7 +65,7 @@ What Is Dynamic Analysis? What Is GNAT DAS? ------------------- -+ Two tools that can work together to analyze code execution ++ Tools that can work together to analyze code execution + :toolname:`GNATcoverage` @@ -74,3 +74,7 @@ What Is GNAT DAS? + :toolname:`GNATtest` + Creates framework to build software tests for your codebase + + + :toolname:`GNATfuzz` + + + Automates dynamic testing by generating and executing test cases to discover software vulnerabilities From 3abc43161de5a70a6feb2b792b1ae613455f0167 Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:42:16 -0500 Subject: [PATCH 5/9] Page 198 - Test_Statement has four parameters not three (in bottom bullet) (and 199, 201) --- courses/gnatdas/cover_010_overview.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/courses/gnatdas/cover_010_overview.rst b/courses/gnatdas/cover_010_overview.rst index 832bb633c..e61e41cd2 100644 --- a/courses/gnatdas/cover_010_overview.rst +++ b/courses/gnatdas/cover_010_overview.rst @@ -85,7 +85,7 @@ Statement Coverage .. image:: gnatdas/cover_statement.png :width: 75% -* Call :ada:`Test_Statement` with :ada:`(1, 2, Integer'Last)` +* Call :ada:`Test_Statement` with :ada:`(1, 2, Integer'Last, X)` * Congratulations: 100% Statement Coverage! But... @@ -109,7 +109,7 @@ Decision Coverage .. image:: gnatdas/cover_decision.png -* Call :ada:`Test_Decision` with :ada:`(0, 0, 0)` and :ada:`(1, 1, Integer'Last)` +* Call :ada:`Test_Decision` with :ada:`(0, 0, 0, X)` and :ada:`(1, 1, Integer'Last, X)` * Congratulations: 100% Decision Coverage! But... @@ -218,7 +218,7 @@ Modified Condition/Decision Coverage Example .. image:: gnatdas/cover_mcdc.png :width: 75% -* Call :ada:`Test_Mcdc` with :ada:`(1, 0, 0)`, :ada:`(0, 1, 0)`, and :ada:`(1, 1, 0)` +* Call :ada:`Test_Mcdc` with :ada:`(1, 0, 0, X)`, :ada:`(0, 1, 0, X)`, and :ada:`(1, 1, 0, X)` * Better test results, but we need more tests * In general, if there are N subconditions, need N+1 sets of data to get complete MCDC coverage From b2fcab55a2056f1a013e105ebf783fe5b943c87b Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:45:11 -0500 Subject: [PATCH 6/9] Slide 235 (xcov Output File): Colon (":") appears inconsistently "Without exemptions:" compared to "With exemptions" --- courses/gnatdas/cover_030_advanced_topics.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/courses/gnatdas/cover_030_advanced_topics.rst b/courses/gnatdas/cover_030_advanced_topics.rst index d722673b2..82b618dfa 100644 --- a/courses/gnatdas/cover_030_advanced_topics.rst +++ b/courses/gnatdas/cover_030_advanced_topics.rst @@ -352,7 +352,6 @@ xml .. container:: latex_environment tiny With exemptions - :: 60% of 5 lines covered From ca15ca86b31579726c73f4df4e88ff6e9ef7c8af Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:49:48 -0500 Subject: [PATCH 7/9] Page 274 - mention that building harness generates executable "test_runner" --- courses/gnatdas/test_020_usage.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/courses/gnatdas/test_020_usage.rst b/courses/gnatdas/test_020_usage.rst index 4dd3066d0..573a96128 100644 --- a/courses/gnatdas/test_020_usage.rst +++ b/courses/gnatdas/test_020_usage.rst @@ -69,6 +69,8 @@ Building a Test Harness * To run the driver, build and run the executable in the :filename:`obj/driver` folder + * Executable is called :command:`test_runner` + .. container:: latex_environment tiny :: @@ -77,7 +79,7 @@ Building a Test Harness gprbuild -P test_driver test_runner - Gives the result:: + *Gives the result* :: simple.ads:3:4: error: corresponding test FAILED: Test not implemented. (simple-test_data-tests.adb:44) simple.ads:7:4: error: corresponding test FAILED: Test not implemented. (simple-test_data-tests.adb:65) From fd37103b31cec368a9b4c1b4bf27233c5160f2df Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:54:52 -0500 Subject: [PATCH 8/9] Slide 305 (Create Tests): text is too small to read Just using some examples --- .../test_030_controlling_gnattest.lab.rst | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/courses/gnatdas/labs/test_030_controlling_gnattest.lab.rst b/courses/gnatdas/labs/test_030_controlling_gnattest.lab.rst index d330247f8..b9e0483db 100644 --- a/courses/gnatdas/labs/test_030_controlling_gnattest.lab.rst +++ b/courses/gnatdas/labs/test_030_controlling_gnattest.lab.rst @@ -57,9 +57,7 @@ Build Harness for One Unit Create Tests -------------- -* Re-write or copy the test answers from the *Usage* lab (or use these) - -.. container:: latex_environment tiny +* Re-write or copy the test answers from the *Usage* lab (here are some examples) .. code:: Ada @@ -96,35 +94,6 @@ Create Tests Reset; AUnit.Assertions.Assert (Empty, "Stack not empty"); - -- Full - while not Full loop - Push (567); - end loop; - Push (999); - AUnit.Assertions.Assert (Full and then Top = 567, - "Full check failed"); - - -- Top - Reset; - declare - Pushed : constant integer := 234; - begin - Push (Pushed); - AUnit.Assertions.Assert (Pushed = Top, - "Top test failed"); - end; - - -- Count - Reset; - Push (111); - AUnit.Assertions.Assert (Count = 1, - "Count test failed"); - - -- Reset - Reset; - AUnit.Assertions.Assert (Count = 0 and then Empty, - "Reset test failed"); - ----------------------------------- Ensure Every Test Starts the Same ----------------------------------- From 2b3b6e6b6716b0d33950707aaf46da181819d989 Mon Sep 17 00:00:00 2001 From: Michael Frank <55284511+frank-at-adacore@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:58:42 -0500 Subject: [PATCH 9/9] Slide 315 (Running Multiple Test Harnesses): first line of output clipped --- courses/gnatdas/test_040_advanced_testing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/courses/gnatdas/test_040_advanced_testing.rst b/courses/gnatdas/test_040_advanced_testing.rst index 2c0b518f4..800812caa 100644 --- a/courses/gnatdas/test_040_advanced_testing.rst +++ b/courses/gnatdas/test_040_advanced_testing.rst @@ -134,9 +134,9 @@ Running Multiple Test Harnesses .. container:: latex_environment tiny - :: + .. code:: output - dependent.ads:2:4: error: corresponding test FAILED: Test not implemented. (dependent-test_data-tests.adb:44) + depend.ads:2:4: error: corresponding test FAILED: Test not implemented. (depend-test_data-tests.adb:44) simple.ads:7:4: error: corresponding test FAILED: Test not implemented. (simple-test_data-tests.adb:65) simple.ads:3:4: error: corresponding test FAILED: Test not implemented. (simple-test_data-tests.adb:44) 3 tests run: 0 passed; 3 failed; 0 crashed.