From: Thomas Walker Lynch Date: Sat, 7 Dec 2024 11:49:41 +0000 (+0000) Subject: adding pencils, shell->bash, RT-incommon sharing X-Git-Url: https://git.reasoningtechnology.com/style/static/git-logo.png?a=commitdiff_plain;h=f9a2f2b2c540a410f3b25156b1f009826daedd26;p=Mosaic adding pencils, shell->bash, RT-incommon sharing --- diff --git "a/developer/tool\360\237\226\211/env" "b/developer/tool\360\237\226\211/env" index 66446d4..79434ec 100644 --- "a/developer/tool\360\237\226\211/env" +++ "b/developer/tool\360\237\226\211/env" @@ -3,17 +3,19 @@ script_afp=$(realpath "${BASH_SOURCE[0]}") # input guards - env_must_be="tool_shared/bespoke/env" - error=false + env_must_be="tool_shared/bespoke🖉/env" + error_bad_env=false + error_not_sourced=false if [ "$ENV" != "$env_must_be" ]; then echo "$(script_fp):: error: must be run in the $env_must_be environment" - error=true + error_bad_env=true fi if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then echo "$script_afp:: This script must be sourced, not executed." - error=true + error_not_sourced=true fi - if $error; then exit 1; fi + if $error_not_sourced; then exit 1; fi + if $error_bad_env; then return 1; fi # so we can do the build diff --git a/env_administrator b/env_administrator deleted file mode 100644 index bb09700..0000000 --- a/env_administrator +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") -if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then - echo "$script_afp:: This script must be sourced, not executed." - exit 1 -fi - -source tool_shared/bespoke/env -source tool/env - diff --git "a/env_administrator\360\237\226\211" "b/env_administrator\360\237\226\211" new file mode 100644 index 0000000..2f09f8a --- /dev/null +++ "b/env_administrator\360\237\226\211" @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") +if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + echo "$script_afp:: This script must be sourced, not executed." + exit 1 +fi + +source tool_shared/bespoke🖉/env +source tool🖉/env + diff --git a/env_developer b/env_developer deleted file mode 100644 index 6240b20..0000000 --- a/env_developer +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") -if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then - echo "$script_afp:: This script must be sourced, not executed." - exit 1 -fi - -source tool_shared/bespoke/env -source developer/tool/env - diff --git a/env_developer b/env_developer new file mode 120000 index 0000000..3089081 --- /dev/null +++ b/env_developer @@ -0,0 +1 @@ +tool_shared/third_party/RT-incommon/release/bash/env_developer \ No newline at end of file diff --git a/env_tester b/env_tester deleted file mode 100644 index 44aace3..0000000 --- a/env_tester +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") -if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then - echo "$script_afp:: This script must be sourced, not executed." - exit 1 -fi - -source tool_shared/bespoke/env -source tester/tool/env diff --git a/env_tester b/env_tester new file mode 120000 index 0000000..81d9f79 --- /dev/null +++ b/env_tester @@ -0,0 +1 @@ +tool_shared/third_party/RT-incommon/release/bash/env_tester \ No newline at end of file diff --git a/tester/bash/.githolder b/tester/bash/.githolder new file mode 100644 index 0000000..e69de29 diff --git a/tester/bash/Test0 b/tester/bash/Test0 new file mode 100755 index 0000000..5b3584f --- /dev/null +++ b/tester/bash/Test0 @@ -0,0 +1,2 @@ +#!/bin/env bash +java Test0 diff --git a/tester/bash/Test_IO b/tester/bash/Test_IO new file mode 100755 index 0000000..72977e7 --- /dev/null +++ b/tester/bash/Test_IO @@ -0,0 +1,2 @@ +#!/bin/env bash +java Test_IO diff --git a/tester/bash/Test_MockClass_0 b/tester/bash/Test_MockClass_0 new file mode 100755 index 0000000..d24ad96 --- /dev/null +++ b/tester/bash/Test_MockClass_0 @@ -0,0 +1,2 @@ +#!/bin/env bash +java Test_MockClass_0 diff --git a/tester/bash/Test_Testbench b/tester/bash/Test_Testbench new file mode 100755 index 0000000..b46456c --- /dev/null +++ b/tester/bash/Test_Testbench @@ -0,0 +1,2 @@ +#!/bin/env bash +java Test_Testbench diff --git a/tester/bash/Test_Util b/tester/bash/Test_Util new file mode 100755 index 0000000..0e4ba3d --- /dev/null +++ b/tester/bash/Test_Util @@ -0,0 +1,2 @@ +#!/bin/env bash +java Test_Util diff --git a/tester/bash/test_log.txt b/tester/bash/test_log.txt new file mode 100644 index 0000000..fcb2724 --- /dev/null +++ b/tester/bash/test_log.txt @@ -0,0 +1,14 @@ + +2024-11-08T09:58:55.370638Z ----------------------------------------------------------- +Test: test_failure_3 +Stream: stdout +Output: +Intentional extraneous chars to stdout for testing + + +2024-11-08T09:58:55.380370Z ----------------------------------------------------------- +Test: test_failure_4 +Stream: stderr +Output: +Intentional extraneous chars to stderr for testing. + diff --git a/tester/document/Writing a test.txt b/tester/document/Writing a test.txt deleted file mode 100644 index d2d02ed..0000000 --- a/tester/document/Writing a test.txt +++ /dev/null @@ -1,50 +0,0 @@ - -I did not use Mosaic to test itself, although Test_MockClass_0 comes close. - -TestMockClass has the general form of a test that uses Mosaic, though MockClass -itself does not exist. This general form: - -*. For block testing there conventionally be a correspondence between - The test classes and the a class being tested, so each test class will - be named: - - `Test__'. - - Typically the lowest `number` will be zero, and it will correspond to - smoke tests. - -* A `Test__' class will have inside of it another class - called `TestSuite`. By convention each method in this class is a test routine. For block - testing a test routine will has a correspondence to the method being tested, - and has the name: - - `test__`. - - This convention is not always followed, no that in `Test_MackClass_0` you will - notice that tests are named after the expected results rather than a method - that is being tested. - - Test routines can run a number of tests on a RUT, each of which is referred to - as a test case. So we have this hierarchy: - - `Test__' > `TestSuite` > test_routine > test_case - -*. The main call for a Test class will parse arguments and options, setup - the testing environment, make a `TestSuite` object, pass said object to - the `TestBench`, then take the return value from the `Testbench`, and set - the return value from the test. - -* A test routines will return `true` if the test passes. Any other return - value, any uncaught exception, or anything left on the stdout or stderr - will cause the test to be interpreted as a failure. (On the todo list is - an item to make unused stdin an error as well.) - -* A test reoutine (nor the contained test cases) should not themselves print - any messages. Generally it has always been this way, even before the Testbench - redirected and the i/o streams. Rather the test should simply return true - for a pass. This is because in testing we are looking for function failures, - and not for faults. The fault will be searched for later in the debugger. - - If a test routine has an internal error, such that the routine itself - has a problem (not the RUT it is testing), this can be put in a log - entry. See the Mosaic_Util for the log methods. diff --git a/tester/document/build_run_transcript_v1.0.txt b/tester/document/build_run_transcript_v1.0.txt deleted file mode 100644 index 615640a..0000000 --- a/tester/document/build_run_transcript_v1.0.txt +++ /dev/null @@ -1,62 +0,0 @@ -This shows all tests passing. - -Tests named `test_failure_` should fail. We need to know that the `TestBench` -can fail tests, so this is part of testing the `TestBench`. - -> cd Mosaic -> source env_tester -> emacs & - -... - -2024-11-04T11:23:08Z[Mosaic_tester] -Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic§ -> clean_build_directories -+ cd /var/user_data/Thomas-developer/Mosaic/tester -+ rm -r scratchpad/Test0.class scratchpad/Test_IO.class 'scratchpad/Test_MockClass$TestSuite.class' scratchpad/Test_MockClass.class scratchpad/Test_TestBench.class scratchpad/Test_Util.class -+ rm jvm/Test_Mosaic.jar -+ rm shell/Test0 shell/Test_IO shell/Test_MockClass shell/Test_TestBench shell/Test_Util -+ set +x -clean_build_directories done. - -2024-11-04T11:23:23Z[Mosaic_tester] -Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic§ -> make -Compiling files... -+ cd /var/user_data/Thomas-developer/Mosaic/tester -+ javac -g -d scratchpad javac/Test0.java javac/Test_IO.java javac/Test_MockClass.java javac/Test_TestBench.java javac/Test_Util.java -+ jar cf jvm/Test_Mosaic.jar -C scratchpad . -+ set +x -Creating shell wrappers... -tester/tool/make done. - -2024-11-04T11:23:27Z[Mosaic_tester] -Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic§ -> run_tests -Running Test0...Test0 passed -Running Test_Util...Test_Util passed -Running Test_IO...Test_IO passed -Running Test_TestBench...Expected output: Structural problem message for dummy_invalid_return_method. -Structural problem: dummy_invalid_return_method does not return Boolean. -Test_TestBench Total tests run: 3 -Test_TestBench Total tests passed: 3 -Test_TestBench Total tests failed: 0 -Running Test_MockClass...Test failed: 'test_failure_0' reported failure. -Structural problem: test_failure_1 does not return Boolean. -Error: test_failure_1 has an invalid structure. -Test failed: 'test_failure_2' threw an exception: java.lang.reflect.InvocationTargetException -Test failed: 'test_failure_3' produced extraneous stdout. -Test failed: 'test_failure_4' produced extraneous stderr. -Total tests run: 9 -Total tests passed: 4 -Total tests failed: 5 - -2024-11-04T11:23:33Z[Mosaic_tester] -Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic§ -> clean_build_directories -+ cd /var/user_data/Thomas-developer/Mosaic/tester -+ rm -r scratchpad/Test0.class scratchpad/Test_IO.class 'scratchpad/Test_MockClass$TestSuite.class' scratchpad/Test_MockClass.class scratchpad/Test_TestBench.class scratchpad/Test_Util.class -+ rm jvm/Test_Mosaic.jar -+ rm shell/Test0 shell/Test_IO shell/test_log.txt shell/Test_MockClass shell/Test_TestBench shell/Test_Util -+ set +x -clean_build_directories done. diff --git a/tester/document/build_run_transcript_v1.1.txt b/tester/document/build_run_transcript_v1.1.txt deleted file mode 100644 index feb0d04..0000000 --- a/tester/document/build_run_transcript_v1.1.txt +++ /dev/null @@ -1,74 +0,0 @@ -This shows all tests passing. - -Tests named `test_failure_` should fail. We need to know that the `TestBench` -can fail tests, so this is part of testing the `TestBench`. - -Staring the environment: - -2024-11-08T07:41:48Z[] -Thomas-developer@Blossac§/var/user_data/Thomas-developer§ -> bash - -2024-11-08T07:41:51Z[] -Thomas-developer@Blossac§/var/user_data/Thomas-developer§ -> cd Mosaic - -2024-11-08T07:41:54Z[] -Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic§ -> . env_tester -REPO_HOME /var/user_data/Thomas-developer/Mosaic -PROJECT Mosaic -ENV tool_shared/bespoke/env -ENV tester/tool/env - -2024-11-08T07:42:04Z[Mosaic_tester] -Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic/tester§ -> emacs & - -Running the tests: - -2024-11-08T09:58:40Z[Mosaic_tester] -Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic/tester§ -> clean_build_directories -+ cd /var/user_data/Thomas-developer/Mosaic/tester -+ rm -r scratchpad/Test0.class scratchpad/Test_IO.class 'scratchpad/Test_MockClass_0$TestSuite.class' scratchpad/Test_MockClass_0.class scratchpad/Test_Testbench.class scratchpad/Test_Util.class -+ rm jvm/Test_Mosaic.jar -+ rm shell/Test0 shell/Test_IO shell/test_log.txt shell/Test_MockClass_0 shell/Test_Testbench shell/Test_Util -+ set +x -clean_build_directories done. - -2024-11-08T09:58:46Z[Mosaic_tester] -Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic/tester§ -> make -Compiling files... -+ cd /var/user_data/Thomas-developer/Mosaic/tester -+ javac -g -d scratchpad javac/Test0.java javac/Test_IO.java javac/Test_MockClass_0.java javac/Test_Testbench.java javac/Test_Util.java -+ jar cf jvm/Test_Mosaic.jar -C scratchpad . -+ set +x -Creating shell wrappers... -tester/tool/make done. - -2024-11-08T09:58:50Z[Mosaic_tester] -Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic/tester§ -> run_tests -Running Test0...Test0 passed -Running Test_Util...Test_Util passed -Running Test_IO...Test_IO passed -Running Test_Testbench...Expected output: Structural problem message for dummy_invalid_return_method. -Structural problem: dummy_invalid_return_method does not return Boolean. -Test_Testbench Total tests run: 3 -Test_Testbench Total tests passed: 3 -Test_Testbench Total tests failed: 0 -Running Test_MockClass_0...Test failed: 'test_failure_0' reported failure. -Structural problem: test_failure_1 does not return Boolean. -Error: test_failure_1 has an invalid structure. -Test failed: 'test_failure_2' threw an exception: java.lang.reflect.InvocationTargetException -Test failed: 'test_failure_3' produced extraneous stdout. -Test failed: 'test_failure_4' produced extraneous stderr. -Total tests run: 9 -Total tests passed: 4 -Total tests failed: 5 - -2024-11-08T09:58:55Z[Mosaic_tester] -Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic/tester§ -> diff --git "a/tester/document\360\237\226\211/Writing a test.txt" "b/tester/document\360\237\226\211/Writing a test.txt" new file mode 100644 index 0000000..d2d02ed --- /dev/null +++ "b/tester/document\360\237\226\211/Writing a test.txt" @@ -0,0 +1,50 @@ + +I did not use Mosaic to test itself, although Test_MockClass_0 comes close. + +TestMockClass has the general form of a test that uses Mosaic, though MockClass +itself does not exist. This general form: + +*. For block testing there conventionally be a correspondence between + The test classes and the a class being tested, so each test class will + be named: + + `Test__'. + + Typically the lowest `number` will be zero, and it will correspond to + smoke tests. + +* A `Test__' class will have inside of it another class + called `TestSuite`. By convention each method in this class is a test routine. For block + testing a test routine will has a correspondence to the method being tested, + and has the name: + + `test__`. + + This convention is not always followed, no that in `Test_MackClass_0` you will + notice that tests are named after the expected results rather than a method + that is being tested. + + Test routines can run a number of tests on a RUT, each of which is referred to + as a test case. So we have this hierarchy: + + `Test__' > `TestSuite` > test_routine > test_case + +*. The main call for a Test class will parse arguments and options, setup + the testing environment, make a `TestSuite` object, pass said object to + the `TestBench`, then take the return value from the `Testbench`, and set + the return value from the test. + +* A test routines will return `true` if the test passes. Any other return + value, any uncaught exception, or anything left on the stdout or stderr + will cause the test to be interpreted as a failure. (On the todo list is + an item to make unused stdin an error as well.) + +* A test reoutine (nor the contained test cases) should not themselves print + any messages. Generally it has always been this way, even before the Testbench + redirected and the i/o streams. Rather the test should simply return true + for a pass. This is because in testing we are looking for function failures, + and not for faults. The fault will be searched for later in the debugger. + + If a test routine has an internal error, such that the routine itself + has a problem (not the RUT it is testing), this can be put in a log + entry. See the Mosaic_Util for the log methods. diff --git "a/tester/document\360\237\226\211/build_run_transcript_v1.0.txt" "b/tester/document\360\237\226\211/build_run_transcript_v1.0.txt" new file mode 100644 index 0000000..615640a --- /dev/null +++ "b/tester/document\360\237\226\211/build_run_transcript_v1.0.txt" @@ -0,0 +1,62 @@ +This shows all tests passing. + +Tests named `test_failure_` should fail. We need to know that the `TestBench` +can fail tests, so this is part of testing the `TestBench`. + +> cd Mosaic +> source env_tester +> emacs & + +... + +2024-11-04T11:23:08Z[Mosaic_tester] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic§ +> clean_build_directories ++ cd /var/user_data/Thomas-developer/Mosaic/tester ++ rm -r scratchpad/Test0.class scratchpad/Test_IO.class 'scratchpad/Test_MockClass$TestSuite.class' scratchpad/Test_MockClass.class scratchpad/Test_TestBench.class scratchpad/Test_Util.class ++ rm jvm/Test_Mosaic.jar ++ rm shell/Test0 shell/Test_IO shell/Test_MockClass shell/Test_TestBench shell/Test_Util ++ set +x +clean_build_directories done. + +2024-11-04T11:23:23Z[Mosaic_tester] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic§ +> make +Compiling files... ++ cd /var/user_data/Thomas-developer/Mosaic/tester ++ javac -g -d scratchpad javac/Test0.java javac/Test_IO.java javac/Test_MockClass.java javac/Test_TestBench.java javac/Test_Util.java ++ jar cf jvm/Test_Mosaic.jar -C scratchpad . ++ set +x +Creating shell wrappers... +tester/tool/make done. + +2024-11-04T11:23:27Z[Mosaic_tester] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic§ +> run_tests +Running Test0...Test0 passed +Running Test_Util...Test_Util passed +Running Test_IO...Test_IO passed +Running Test_TestBench...Expected output: Structural problem message for dummy_invalid_return_method. +Structural problem: dummy_invalid_return_method does not return Boolean. +Test_TestBench Total tests run: 3 +Test_TestBench Total tests passed: 3 +Test_TestBench Total tests failed: 0 +Running Test_MockClass...Test failed: 'test_failure_0' reported failure. +Structural problem: test_failure_1 does not return Boolean. +Error: test_failure_1 has an invalid structure. +Test failed: 'test_failure_2' threw an exception: java.lang.reflect.InvocationTargetException +Test failed: 'test_failure_3' produced extraneous stdout. +Test failed: 'test_failure_4' produced extraneous stderr. +Total tests run: 9 +Total tests passed: 4 +Total tests failed: 5 + +2024-11-04T11:23:33Z[Mosaic_tester] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic§ +> clean_build_directories ++ cd /var/user_data/Thomas-developer/Mosaic/tester ++ rm -r scratchpad/Test0.class scratchpad/Test_IO.class 'scratchpad/Test_MockClass$TestSuite.class' scratchpad/Test_MockClass.class scratchpad/Test_TestBench.class scratchpad/Test_Util.class ++ rm jvm/Test_Mosaic.jar ++ rm shell/Test0 shell/Test_IO shell/test_log.txt shell/Test_MockClass shell/Test_TestBench shell/Test_Util ++ set +x +clean_build_directories done. diff --git "a/tester/document\360\237\226\211/build_run_transcript_v1.1.txt" "b/tester/document\360\237\226\211/build_run_transcript_v1.1.txt" new file mode 100644 index 0000000..feb0d04 --- /dev/null +++ "b/tester/document\360\237\226\211/build_run_transcript_v1.1.txt" @@ -0,0 +1,74 @@ +This shows all tests passing. + +Tests named `test_failure_` should fail. We need to know that the `TestBench` +can fail tests, so this is part of testing the `TestBench`. + +Staring the environment: + +2024-11-08T07:41:48Z[] +Thomas-developer@Blossac§/var/user_data/Thomas-developer§ +> bash + +2024-11-08T07:41:51Z[] +Thomas-developer@Blossac§/var/user_data/Thomas-developer§ +> cd Mosaic + +2024-11-08T07:41:54Z[] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic§ +> . env_tester +REPO_HOME /var/user_data/Thomas-developer/Mosaic +PROJECT Mosaic +ENV tool_shared/bespoke/env +ENV tester/tool/env + +2024-11-08T07:42:04Z[Mosaic_tester] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic/tester§ +> emacs & + +Running the tests: + +2024-11-08T09:58:40Z[Mosaic_tester] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic/tester§ +> clean_build_directories ++ cd /var/user_data/Thomas-developer/Mosaic/tester ++ rm -r scratchpad/Test0.class scratchpad/Test_IO.class 'scratchpad/Test_MockClass_0$TestSuite.class' scratchpad/Test_MockClass_0.class scratchpad/Test_Testbench.class scratchpad/Test_Util.class ++ rm jvm/Test_Mosaic.jar ++ rm shell/Test0 shell/Test_IO shell/test_log.txt shell/Test_MockClass_0 shell/Test_Testbench shell/Test_Util ++ set +x +clean_build_directories done. + +2024-11-08T09:58:46Z[Mosaic_tester] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic/tester§ +> make +Compiling files... ++ cd /var/user_data/Thomas-developer/Mosaic/tester ++ javac -g -d scratchpad javac/Test0.java javac/Test_IO.java javac/Test_MockClass_0.java javac/Test_Testbench.java javac/Test_Util.java ++ jar cf jvm/Test_Mosaic.jar -C scratchpad . ++ set +x +Creating shell wrappers... +tester/tool/make done. + +2024-11-08T09:58:50Z[Mosaic_tester] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic/tester§ +> run_tests +Running Test0...Test0 passed +Running Test_Util...Test_Util passed +Running Test_IO...Test_IO passed +Running Test_Testbench...Expected output: Structural problem message for dummy_invalid_return_method. +Structural problem: dummy_invalid_return_method does not return Boolean. +Test_Testbench Total tests run: 3 +Test_Testbench Total tests passed: 3 +Test_Testbench Total tests failed: 0 +Running Test_MockClass_0...Test failed: 'test_failure_0' reported failure. +Structural problem: test_failure_1 does not return Boolean. +Error: test_failure_1 has an invalid structure. +Test failed: 'test_failure_2' threw an exception: java.lang.reflect.InvocationTargetException +Test failed: 'test_failure_3' produced extraneous stdout. +Test failed: 'test_failure_4' produced extraneous stderr. +Total tests run: 9 +Total tests passed: 4 +Total tests failed: 5 + +2024-11-08T09:58:55Z[Mosaic_tester] +Thomas-developer@Blossac§/var/user_data/Thomas-developer/Mosaic/tester§ +> diff --git a/tester/javac/Test0.java b/tester/javac/Test0.java deleted file mode 100644 index c4abc4a..0000000 --- a/tester/javac/Test0.java +++ /dev/null @@ -1,36 +0,0 @@ -import com.ReasoningTechnology.Mosaic.Mosaic_Util; - -/* -Test Zero - -Plug it in, see if there is smoke. There usually is. - -*/ - -public class Test0{ - - public static Boolean test_is_true(){ - return true; - } - - public static int run(){ - Boolean[] condition = new Boolean[1]; - condition[0] = test_is_true(); - - int i = 0; - if( !Mosaic_Util.all(condition) ){ - System.out.println("Test0 failed"); - return 1; - } - System.out.println("Test0 passed"); - return 0; - } - - // Main function to provide a shell interface for running tests - public static void main(String[] args){ - int return_code = run(); - System.exit(return_code); - return; - } - -} diff --git a/tester/javac/Test_IO.java b/tester/javac/Test_IO.java deleted file mode 100644 index a7f8248..0000000 --- a/tester/javac/Test_IO.java +++ /dev/null @@ -1,73 +0,0 @@ -import com.ReasoningTechnology.Mosaic.Mosaic_IO; -import com.ReasoningTechnology.Mosaic.Mosaic_Util; - -public class Test_IO{ - - public static int fut(){ - try{ - // Echo some characters from stdin to stdout - System.out.print((char) System.in.read()); - System.out.print((char) System.in.read()); - - // Echo some more characters from stdin to stderr - System.err.print((char) System.in.read()); - System.err.print((char) System.in.read()); - - // Count remaining characters until EOF - int count = 0; - while(System.in.read() != -1){ - count++; - } - - return count; - } catch(Exception e){ - e.printStackTrace(); - return -1; // Error case - } - } - - public static int run(){ - Mosaic_IO io = new Mosaic_IO(); - Boolean[] condition = new Boolean[3]; - - // Redirect IO streams - io.redirect(); - - // Provide input for the function under test - io.push_input("abcdefg"); - - // Execute function under test - int result = fut(); - - // Check stdout content - String stdout_string = io.get_out_content(); - condition[0] = stdout_string.equals("ab"); - - // Check stderr content - String stderr_string = io.get_err_content(); - condition[1] = stderr_string.equals("cd"); - - // Check returned character count (3 remaining characters: 'e','f','g') - condition[2] = result == 3; - - // Restore original IO streams - io.restore(); - - if(!Mosaic_Util.all(condition)){ - System.out.println("Test_IO failed"); - return 1; - } - System.out.println("Test_IO passed"); - return 0; - } - - // Main function to provide a shell interface for running tests - public static void main(String[] args){ - int return_code = run(); - System.exit(return_code); - return; - } - -} - - diff --git a/tester/javac/Test_MockClass_0.java b/tester/javac/Test_MockClass_0.java deleted file mode 100644 index 0f02a64..0000000 --- a/tester/javac/Test_MockClass_0.java +++ /dev/null @@ -1,98 +0,0 @@ -/* -------------------------------------------------------------------------------- - Integration tests directly simulate the use cases for Mosaic_Testbench. - Each test method validates a specific feature of Mosaic_Testbench ,including pass, - fail ,error handling ,and I/O interactions. -*/ - -import java.util.Scanner; -import com.ReasoningTechnology.Mosaic.Mosaic_IO; -import com.ReasoningTechnology.Mosaic.Mosaic_Testbench; - -public class Test_MockClass_0{ - - public class TestSuite{ - - public TestSuite() { - // no special initialization of data for this test - } - - public Boolean test_failure_0(Mosaic_IO io){ - return false; - } - - // returns a non-Boolean - public Object test_failure_1(Mosaic_IO io){ - return 1; - } - - // has an uncaught error - public Boolean test_failure_2(Mosaic_IO io) throws Exception { - throw new Exception("Intentional exception for testing error handling"); - } - - // extraneous characters on stdout - public Boolean test_failure_3(Mosaic_IO io) throws Exception { - System.out.println("Intentional extraneous chars to stdout for testing"); - return true; - } - - // extraneous characters on stderr - public Boolean test_failure_4(Mosaic_IO io) throws Exception { - System.err.println("Intentional extraneous chars to stderr for testing."); - return true; - } - - public Boolean test_success_0(Mosaic_IO io){ - return true; - } - - // pushing input for testing - - public Boolean test_success_1(Mosaic_IO io){ - io.push_input("input for the fut"); - - Scanner scanner = new Scanner(System.in); - String result = scanner.nextLine(); - scanner.close(); - - Boolean flag = result.equals("input for the fut"); - return flag; - } - - // checking fut stdout - public Boolean test_success_2(Mosaic_IO io){ - System.out.println("fut stdout"); // suppose the fut does this: - String peek_at_futs_output = io.get_out_content(); - Boolean flag0 = io.has_out_content(); - Boolean flag1 = peek_at_futs_output.equals("fut stdout\n"); - io.clear_buffers(); // otherwise extraneous chars will cause an fail - return flag0 && flag1; - } - - // checking fut stderr - public Boolean test_success_3(Mosaic_IO io){ - System.err.print("fut stderr"); // suppose the fut does this: - String peek_at_futs_output = io.get_err_content(); - Boolean flag0 = io.has_err_content(); - Boolean flag1 = peek_at_futs_output.equals("fut stderr"); - io.clear_buffers(); // otherwise extraneous chars will cause an fail - return flag0 && flag1; - } - - } - - public static void main(String[] args) { - Test_MockClass_0 outer = new Test_MockClass_0(); - TestSuite suite = outer.new TestSuite(); // Non-static instantiation - - /* for debug - Mosaic_IO io = new Mosaic_IO(); - io.redirect(); - suite.test_success_2(io); - */ - - int result = Mosaic_Testbench.run(suite); // Pass the suite instance to Mosaic_Testbench - System.exit(result); - } - -} diff --git a/tester/javac/Test_Testbench.java b/tester/javac/Test_Testbench.java deleted file mode 100644 index 56f9e21..0000000 --- a/tester/javac/Test_Testbench.java +++ /dev/null @@ -1,82 +0,0 @@ -import java.lang.reflect.Method; -import com.ReasoningTechnology.Mosaic.Mosaic_IO; -import com.ReasoningTechnology.Mosaic.Mosaic_Testbench; - -public class Test_Testbench { - - /* -------------------------------------------------------------------------------- - Test methods to validate Testbench functionality - Each method tests a specific aspect of the Testbench class, with a focus on - ensuring that well-formed and ill-formed test cases are correctly identified - and handled. - */ - - // Tests if a correctly formed method is recognized as well-formed by Testbench - public static Boolean test_method_is_wellformed_0(Mosaic_IO io) { - try { - Method validMethod = Test_Testbench.class.getMethod("dummy_test_method", Mosaic_IO.class); - return Boolean.TRUE.equals(Mosaic_Testbench.method_is_wellformed(validMethod)); - } catch (NoSuchMethodException e) { - return false; - } - } - - // Tests if a method with an invalid return type is identified as malformed by Testbench - public static Boolean test_method_is_wellformed_1(Mosaic_IO io) { - System.out.println("Expected output: Structural problem message for dummy_invalid_return_method."); - try { - Method invalidReturnMethod = Test_Testbench.class.getMethod("dummy_invalid_return_method", Mosaic_IO.class); - return Boolean.FALSE.equals(Mosaic_Testbench.method_is_wellformed(invalidReturnMethod)); - } catch (NoSuchMethodException e) { - return false; - } - } - - // Tests if a valid test method runs successfully with the Testbench - public static Boolean test_run_test_0(Mosaic_IO io) { - try { - Method validMethod = Test_Testbench.class.getMethod("dummy_test_method", Mosaic_IO.class); - return Boolean.TRUE.equals(Mosaic_Testbench.run_test(new Test_Testbench(), validMethod, io)); - } catch (NoSuchMethodException e) { - return false; - } - } - - /* Dummy methods for testing */ - public Boolean dummy_test_method(Mosaic_IO io) { - return true; // Simulates a passing test case - } - - public void dummy_invalid_return_method(Mosaic_IO io) { - // Simulates a test case with an invalid return type - } - - /* -------------------------------------------------------------------------------- - Manually run all tests and summarize results without using Testbench itself. - Each test's name is printed if it fails, and only pass/fail counts are summarized. - */ - public static int run() { - int passed_tests = 0; - int failed_tests = 0; - Mosaic_IO io = new Mosaic_IO(); - - if (test_method_is_wellformed_0(io)) passed_tests++; else { System.out.println("test_method_is_wellformed_0"); failed_tests++; } - if (test_method_is_wellformed_1(io)) passed_tests++; else { System.out.println("test_method_is_wellformed_1"); failed_tests++; } - if (test_run_test_0(io)) passed_tests++; else { System.out.println("test_run_test_0"); failed_tests++; } - - // Summary for all the tests - System.out.println("Test_Testbench Total tests run: " + (passed_tests + failed_tests)); - System.out.println("Test_Testbench Total tests passed: " + passed_tests); - System.out.println("Test_Testbench Total tests failed: " + failed_tests); - - return (failed_tests > 0) ? 1 : 0; - } - - /* -------------------------------------------------------------------------------- - Main method for shell interface, sets the exit status based on test results - */ - public static void main(String[] args) { - int exitCode = run(); - System.exit(exitCode); - } -} diff --git a/tester/javac/Test_Util.java b/tester/javac/Test_Util.java deleted file mode 100644 index b959d5e..0000000 --- a/tester/javac/Test_Util.java +++ /dev/null @@ -1,82 +0,0 @@ -import com.ReasoningTechnology.Mosaic.Mosaic_Util; - -/* -Test_Util - -*/ - -public class Test_Util{ - - public static Boolean test_all(){ - // Test with zero condition - Boolean[] condition0 = {}; - Boolean result = !Mosaic_Util.all(condition0); // Empty condition list is false. - - // Test with one condition - Boolean[] condition1_true = {true}; - Boolean[] condition1_false = {false}; - result &= Mosaic_Util.all(condition1_true); // should return true - result &= !Mosaic_Util.all(condition1_false); // should return false - - // Test with two condition - Boolean[] condition2_true = {true, true}; - Boolean[] condition2_false1 = {true, false}; - Boolean[] condition2_false2 = {false, true}; - Boolean[] condition2_false3 = {false, false}; - result &= Mosaic_Util.all(condition2_true); // should return true - result &= !Mosaic_Util.all(condition2_false1); // should return false - result &= !Mosaic_Util.all(condition2_false2); // should return false - result &= !Mosaic_Util.all(condition2_false3); // should return false - - // Test with three condition - Boolean[] condition3_false1 = {true, true, false}; - Boolean[] condition3_true = {true, true, true}; - Boolean[] condition3_false2 = {true, false, true}; - Boolean[] condition3_false3 = {false, true, true}; - Boolean[] condition3_false4 = {false, false, false}; - result &= !Mosaic_Util.all(condition3_false1); // should return false - result &= Mosaic_Util.all(condition3_true); // should return true - result &= !Mosaic_Util.all(condition3_false2); // should return false - result &= !Mosaic_Util.all(condition3_false3); // should return false - result &= !Mosaic_Util.all(condition3_false4); // should return false - - return result; - } - - public static Boolean test_all_set_false(){ - Boolean[] condition_list = {true, true, true}; - Mosaic_Util.all_set_false(condition_list); - return !condition_list[0] && !condition_list[1] && !condition_list[2]; - } - - public static Boolean test_all_set_true(){ - Boolean[] condition_list = {false, false, false}; - Mosaic_Util.all_set_true(condition_list); - return condition_list[0] && condition_list[1] && condition_list[2]; - } - - public static int run(){ - Boolean[] condition_list = new Boolean[3]; - condition_list[0] = test_all(); - condition_list[1] = test_all_set_false(); - condition_list[2] = test_all_set_true(); - - if( - !condition_list[0] - || !condition_list[1] - || !condition_list[2] - ){ - System.out.println("Test_Util failed"); - return 1; - } - System.out.println("Test_Util passed"); - return 0; - } - - // Main function to provide a shell interface for running tests - public static void main(String[] args){ - int return_code = run(); - System.exit(return_code); - return; - } -} diff --git "a/tester/javac\360\237\226\211/Test0.java" "b/tester/javac\360\237\226\211/Test0.java" new file mode 100644 index 0000000..c4abc4a --- /dev/null +++ "b/tester/javac\360\237\226\211/Test0.java" @@ -0,0 +1,36 @@ +import com.ReasoningTechnology.Mosaic.Mosaic_Util; + +/* +Test Zero + +Plug it in, see if there is smoke. There usually is. + +*/ + +public class Test0{ + + public static Boolean test_is_true(){ + return true; + } + + public static int run(){ + Boolean[] condition = new Boolean[1]; + condition[0] = test_is_true(); + + int i = 0; + if( !Mosaic_Util.all(condition) ){ + System.out.println("Test0 failed"); + return 1; + } + System.out.println("Test0 passed"); + return 0; + } + + // Main function to provide a shell interface for running tests + public static void main(String[] args){ + int return_code = run(); + System.exit(return_code); + return; + } + +} diff --git "a/tester/javac\360\237\226\211/Test_IO.java" "b/tester/javac\360\237\226\211/Test_IO.java" new file mode 100644 index 0000000..a7f8248 --- /dev/null +++ "b/tester/javac\360\237\226\211/Test_IO.java" @@ -0,0 +1,73 @@ +import com.ReasoningTechnology.Mosaic.Mosaic_IO; +import com.ReasoningTechnology.Mosaic.Mosaic_Util; + +public class Test_IO{ + + public static int fut(){ + try{ + // Echo some characters from stdin to stdout + System.out.print((char) System.in.read()); + System.out.print((char) System.in.read()); + + // Echo some more characters from stdin to stderr + System.err.print((char) System.in.read()); + System.err.print((char) System.in.read()); + + // Count remaining characters until EOF + int count = 0; + while(System.in.read() != -1){ + count++; + } + + return count; + } catch(Exception e){ + e.printStackTrace(); + return -1; // Error case + } + } + + public static int run(){ + Mosaic_IO io = new Mosaic_IO(); + Boolean[] condition = new Boolean[3]; + + // Redirect IO streams + io.redirect(); + + // Provide input for the function under test + io.push_input("abcdefg"); + + // Execute function under test + int result = fut(); + + // Check stdout content + String stdout_string = io.get_out_content(); + condition[0] = stdout_string.equals("ab"); + + // Check stderr content + String stderr_string = io.get_err_content(); + condition[1] = stderr_string.equals("cd"); + + // Check returned character count (3 remaining characters: 'e','f','g') + condition[2] = result == 3; + + // Restore original IO streams + io.restore(); + + if(!Mosaic_Util.all(condition)){ + System.out.println("Test_IO failed"); + return 1; + } + System.out.println("Test_IO passed"); + return 0; + } + + // Main function to provide a shell interface for running tests + public static void main(String[] args){ + int return_code = run(); + System.exit(return_code); + return; + } + +} + + diff --git "a/tester/javac\360\237\226\211/Test_MockClass_0.java" "b/tester/javac\360\237\226\211/Test_MockClass_0.java" new file mode 100644 index 0000000..0f02a64 --- /dev/null +++ "b/tester/javac\360\237\226\211/Test_MockClass_0.java" @@ -0,0 +1,98 @@ +/* -------------------------------------------------------------------------------- + Integration tests directly simulate the use cases for Mosaic_Testbench. + Each test method validates a specific feature of Mosaic_Testbench ,including pass, + fail ,error handling ,and I/O interactions. +*/ + +import java.util.Scanner; +import com.ReasoningTechnology.Mosaic.Mosaic_IO; +import com.ReasoningTechnology.Mosaic.Mosaic_Testbench; + +public class Test_MockClass_0{ + + public class TestSuite{ + + public TestSuite() { + // no special initialization of data for this test + } + + public Boolean test_failure_0(Mosaic_IO io){ + return false; + } + + // returns a non-Boolean + public Object test_failure_1(Mosaic_IO io){ + return 1; + } + + // has an uncaught error + public Boolean test_failure_2(Mosaic_IO io) throws Exception { + throw new Exception("Intentional exception for testing error handling"); + } + + // extraneous characters on stdout + public Boolean test_failure_3(Mosaic_IO io) throws Exception { + System.out.println("Intentional extraneous chars to stdout for testing"); + return true; + } + + // extraneous characters on stderr + public Boolean test_failure_4(Mosaic_IO io) throws Exception { + System.err.println("Intentional extraneous chars to stderr for testing."); + return true; + } + + public Boolean test_success_0(Mosaic_IO io){ + return true; + } + + // pushing input for testing + + public Boolean test_success_1(Mosaic_IO io){ + io.push_input("input for the fut"); + + Scanner scanner = new Scanner(System.in); + String result = scanner.nextLine(); + scanner.close(); + + Boolean flag = result.equals("input for the fut"); + return flag; + } + + // checking fut stdout + public Boolean test_success_2(Mosaic_IO io){ + System.out.println("fut stdout"); // suppose the fut does this: + String peek_at_futs_output = io.get_out_content(); + Boolean flag0 = io.has_out_content(); + Boolean flag1 = peek_at_futs_output.equals("fut stdout\n"); + io.clear_buffers(); // otherwise extraneous chars will cause an fail + return flag0 && flag1; + } + + // checking fut stderr + public Boolean test_success_3(Mosaic_IO io){ + System.err.print("fut stderr"); // suppose the fut does this: + String peek_at_futs_output = io.get_err_content(); + Boolean flag0 = io.has_err_content(); + Boolean flag1 = peek_at_futs_output.equals("fut stderr"); + io.clear_buffers(); // otherwise extraneous chars will cause an fail + return flag0 && flag1; + } + + } + + public static void main(String[] args) { + Test_MockClass_0 outer = new Test_MockClass_0(); + TestSuite suite = outer.new TestSuite(); // Non-static instantiation + + /* for debug + Mosaic_IO io = new Mosaic_IO(); + io.redirect(); + suite.test_success_2(io); + */ + + int result = Mosaic_Testbench.run(suite); // Pass the suite instance to Mosaic_Testbench + System.exit(result); + } + +} diff --git "a/tester/javac\360\237\226\211/Test_Testbench.java" "b/tester/javac\360\237\226\211/Test_Testbench.java" new file mode 100644 index 0000000..56f9e21 --- /dev/null +++ "b/tester/javac\360\237\226\211/Test_Testbench.java" @@ -0,0 +1,82 @@ +import java.lang.reflect.Method; +import com.ReasoningTechnology.Mosaic.Mosaic_IO; +import com.ReasoningTechnology.Mosaic.Mosaic_Testbench; + +public class Test_Testbench { + + /* -------------------------------------------------------------------------------- + Test methods to validate Testbench functionality + Each method tests a specific aspect of the Testbench class, with a focus on + ensuring that well-formed and ill-formed test cases are correctly identified + and handled. + */ + + // Tests if a correctly formed method is recognized as well-formed by Testbench + public static Boolean test_method_is_wellformed_0(Mosaic_IO io) { + try { + Method validMethod = Test_Testbench.class.getMethod("dummy_test_method", Mosaic_IO.class); + return Boolean.TRUE.equals(Mosaic_Testbench.method_is_wellformed(validMethod)); + } catch (NoSuchMethodException e) { + return false; + } + } + + // Tests if a method with an invalid return type is identified as malformed by Testbench + public static Boolean test_method_is_wellformed_1(Mosaic_IO io) { + System.out.println("Expected output: Structural problem message for dummy_invalid_return_method."); + try { + Method invalidReturnMethod = Test_Testbench.class.getMethod("dummy_invalid_return_method", Mosaic_IO.class); + return Boolean.FALSE.equals(Mosaic_Testbench.method_is_wellformed(invalidReturnMethod)); + } catch (NoSuchMethodException e) { + return false; + } + } + + // Tests if a valid test method runs successfully with the Testbench + public static Boolean test_run_test_0(Mosaic_IO io) { + try { + Method validMethod = Test_Testbench.class.getMethod("dummy_test_method", Mosaic_IO.class); + return Boolean.TRUE.equals(Mosaic_Testbench.run_test(new Test_Testbench(), validMethod, io)); + } catch (NoSuchMethodException e) { + return false; + } + } + + /* Dummy methods for testing */ + public Boolean dummy_test_method(Mosaic_IO io) { + return true; // Simulates a passing test case + } + + public void dummy_invalid_return_method(Mosaic_IO io) { + // Simulates a test case with an invalid return type + } + + /* -------------------------------------------------------------------------------- + Manually run all tests and summarize results without using Testbench itself. + Each test's name is printed if it fails, and only pass/fail counts are summarized. + */ + public static int run() { + int passed_tests = 0; + int failed_tests = 0; + Mosaic_IO io = new Mosaic_IO(); + + if (test_method_is_wellformed_0(io)) passed_tests++; else { System.out.println("test_method_is_wellformed_0"); failed_tests++; } + if (test_method_is_wellformed_1(io)) passed_tests++; else { System.out.println("test_method_is_wellformed_1"); failed_tests++; } + if (test_run_test_0(io)) passed_tests++; else { System.out.println("test_run_test_0"); failed_tests++; } + + // Summary for all the tests + System.out.println("Test_Testbench Total tests run: " + (passed_tests + failed_tests)); + System.out.println("Test_Testbench Total tests passed: " + passed_tests); + System.out.println("Test_Testbench Total tests failed: " + failed_tests); + + return (failed_tests > 0) ? 1 : 0; + } + + /* -------------------------------------------------------------------------------- + Main method for shell interface, sets the exit status based on test results + */ + public static void main(String[] args) { + int exitCode = run(); + System.exit(exitCode); + } +} diff --git "a/tester/javac\360\237\226\211/Test_Util.java" "b/tester/javac\360\237\226\211/Test_Util.java" new file mode 100644 index 0000000..b959d5e --- /dev/null +++ "b/tester/javac\360\237\226\211/Test_Util.java" @@ -0,0 +1,82 @@ +import com.ReasoningTechnology.Mosaic.Mosaic_Util; + +/* +Test_Util + +*/ + +public class Test_Util{ + + public static Boolean test_all(){ + // Test with zero condition + Boolean[] condition0 = {}; + Boolean result = !Mosaic_Util.all(condition0); // Empty condition list is false. + + // Test with one condition + Boolean[] condition1_true = {true}; + Boolean[] condition1_false = {false}; + result &= Mosaic_Util.all(condition1_true); // should return true + result &= !Mosaic_Util.all(condition1_false); // should return false + + // Test with two condition + Boolean[] condition2_true = {true, true}; + Boolean[] condition2_false1 = {true, false}; + Boolean[] condition2_false2 = {false, true}; + Boolean[] condition2_false3 = {false, false}; + result &= Mosaic_Util.all(condition2_true); // should return true + result &= !Mosaic_Util.all(condition2_false1); // should return false + result &= !Mosaic_Util.all(condition2_false2); // should return false + result &= !Mosaic_Util.all(condition2_false3); // should return false + + // Test with three condition + Boolean[] condition3_false1 = {true, true, false}; + Boolean[] condition3_true = {true, true, true}; + Boolean[] condition3_false2 = {true, false, true}; + Boolean[] condition3_false3 = {false, true, true}; + Boolean[] condition3_false4 = {false, false, false}; + result &= !Mosaic_Util.all(condition3_false1); // should return false + result &= Mosaic_Util.all(condition3_true); // should return true + result &= !Mosaic_Util.all(condition3_false2); // should return false + result &= !Mosaic_Util.all(condition3_false3); // should return false + result &= !Mosaic_Util.all(condition3_false4); // should return false + + return result; + } + + public static Boolean test_all_set_false(){ + Boolean[] condition_list = {true, true, true}; + Mosaic_Util.all_set_false(condition_list); + return !condition_list[0] && !condition_list[1] && !condition_list[2]; + } + + public static Boolean test_all_set_true(){ + Boolean[] condition_list = {false, false, false}; + Mosaic_Util.all_set_true(condition_list); + return condition_list[0] && condition_list[1] && condition_list[2]; + } + + public static int run(){ + Boolean[] condition_list = new Boolean[3]; + condition_list[0] = test_all(); + condition_list[1] = test_all_set_false(); + condition_list[2] = test_all_set_true(); + + if( + !condition_list[0] + || !condition_list[1] + || !condition_list[2] + ){ + System.out.println("Test_Util failed"); + return 1; + } + System.out.println("Test_Util passed"); + return 0; + } + + // Main function to provide a shell interface for running tests + public static void main(String[] args){ + int return_code = run(); + System.exit(return_code); + return; + } +} diff --git a/tester/shell/.githolder b/tester/shell/.githolder deleted file mode 100644 index e69de29..0000000 diff --git a/tester/shell/Test0 b/tester/shell/Test0 deleted file mode 100755 index 5b3584f..0000000 --- a/tester/shell/Test0 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/env bash -java Test0 diff --git a/tester/shell/Test_IO b/tester/shell/Test_IO deleted file mode 100755 index 72977e7..0000000 --- a/tester/shell/Test_IO +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/env bash -java Test_IO diff --git a/tester/shell/Test_MockClass_0 b/tester/shell/Test_MockClass_0 deleted file mode 100755 index d24ad96..0000000 --- a/tester/shell/Test_MockClass_0 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/env bash -java Test_MockClass_0 diff --git a/tester/shell/Test_Testbench b/tester/shell/Test_Testbench deleted file mode 100755 index b46456c..0000000 --- a/tester/shell/Test_Testbench +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/env bash -java Test_Testbench diff --git a/tester/shell/Test_Util b/tester/shell/Test_Util deleted file mode 100755 index 0e4ba3d..0000000 --- a/tester/shell/Test_Util +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/env bash -java Test_Util diff --git a/tester/shell/test_log.txt b/tester/shell/test_log.txt deleted file mode 100644 index fcb2724..0000000 --- a/tester/shell/test_log.txt +++ /dev/null @@ -1,14 +0,0 @@ - -2024-11-08T09:58:55.370638Z ----------------------------------------------------------- -Test: test_failure_3 -Stream: stdout -Output: -Intentional extraneous chars to stdout for testing - - -2024-11-08T09:58:55.380370Z ----------------------------------------------------------- -Test: test_failure_4 -Stream: stderr -Output: -Intentional extraneous chars to stderr for testing. - diff --git a/tester/tool/clean_build_directories b/tester/tool/clean_build_directories deleted file mode 100755 index 5b84fd0..0000000 --- a/tester/tool/clean_build_directories +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") - -# Caveat: the 'shell' directory is for built wrapper -# functions. `clean_build_directories` will remove all the files in this -# directory. For bespoke scripts used by the tester, put them in the `tool` -# directory. - -# input guards - env_must_be="tester/tool/env" - if [ "$ENV" != "$env_must_be" ]; then - echo "$(script_fp):: error: must be run in the $env_must_be environment" - exit 1 - fi - -# remove files - set -x - cd "$REPO_HOME"/tester - rm -r scratchpad/* - rm jvm/* - rm shell/* - set +x - -echo "$(script_fn) done." diff --git a/tester/tool/env b/tester/tool/env deleted file mode 100644 index e73741c..0000000 --- a/tester/tool/env +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") - -# input guards - - env_must_be="tool_shared/bespoke/env" - error=false - if [ "$ENV" != "$env_must_be" ]; then - echo "$(script_fp):: error: must be run in the $env_must_be environment" - error=true - fi - if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then - echo "$script_afp:: This script must be sourced, not executed." - error=true - fi - if $error; then exit 1; fi - -# so we can do testing - -export PATH=\ -"$REPO_HOME"/tester/tool/\ -:"$REPO_HOME"/tool_shared/bespoke/\ -:"$JAVA_HOME"/bin\ -:"$PATH" - -export CLASSPATH=\ -"$JAVA_HOME"/lib\ -:"$REPO_HOME"/release/"$PROJECT".jar\ -:"$REPO_HOME"/tester/jvm/Test_"$PROJECT".jar\ -:"$CLASSPATH" - -export SOURCEPATH=\ -"$REPO_HOME"/tester/javac/\ -:"$REPO_HOME"/developer/scratchpad/\ - - -# misc - - # make .githolder and .gitignore visible - alias ls="ls -a" - -# some feedback to show all went well - - export PROMPT_DECOR="$PROJECT"_tester - export ENV=$(script_fp) - echo ENV "$ENV" - cd "$REPO_HOME"/tester/ diff --git a/tester/tool/make b/tester/tool/make deleted file mode 100755 index deae0a1..0000000 --- a/tester/tool/make +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") - -# input guards - - env_must_be="tester/tool/env" - if [ "$ENV" != "$env_must_be" ]; then - echo "$(script_fp):: error: must be run in the $env_must_be environment" - exit 1 - fi - -echo "Compiling files..." - - set -x - cd $REPO_HOME/tester - javac -g -d scratchpad javac/*.java - jar cf jvm/Test_"$PROJECT".jar -C scratchpad . - set +x - -echo "Creating shell wrappers..." - mkdir -p shell - # wrapper is a space separated list - wrapper=$(shell_wrapper_list) - for file in $wrapper;do - cat > shell/$file << EOL -#!/bin/env bash -java $file -EOL - chmod +x shell/$file - done - -echo "$(script_fp) done." diff --git a/tester/tool/run_jdb b/tester/tool/run_jdb deleted file mode 100755 index 9c472f4..0000000 --- a/tester/tool/run_jdb +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") - -# input guards -env_must_be="tester/tool/env" -if [ "$ENV" != "$env_must_be" ]; then - echo "$(script_fp):: error: must be run in the $env_must_be environment" - exit 1 -fi - -jdb -sourcepath "$SOURCEPATH" "$@" - diff --git a/tester/tool/run_tests b/tester/tool/run_tests deleted file mode 100755 index 1e7182b..0000000 --- a/tester/tool/run_tests +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/env bash - -# Ensure REPO_HOME is set -if [ -z "$REPO_HOME" ]; then - echo "Error: REPO_HOME is not set." - exit 1 -fi - -# Navigate to the shell directory -cd "$REPO_HOME/tester/shell" || exit - -# Get the list of test scripts in the specific order from shell_wrapper_list -test_list=$(shell_wrapper_list) - -# Execute each test in the specified order -for file in $test_list; do - if [[ -x "$file" && ! -d "$file" ]]; then - echo -n "Running $file..." - ./"$file" - else - echo "Skipping $file (not executable or is a directory)" - fi -done diff --git a/tester/tool/shell_wrapper_list b/tester/tool/shell_wrapper_list deleted file mode 100755 index 29dd738..0000000 --- a/tester/tool/shell_wrapper_list +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") - -# input guards -env_must_be="tester/tool/env" -if [ "$ENV" != "$env_must_be" ]; then - echo "$(script_fp):: error: must be run in the $env_must_be environment" - exit 1 -fi - -# space separated list of shell interface wrappers -echo Test0 Test_Util Test_IO Test_Testbench Test_MockClass_0 - diff --git "a/tester/tool\360\237\226\211/clean_build_directories" "b/tester/tool\360\237\226\211/clean_build_directories" new file mode 100755 index 0000000..5b84fd0 --- /dev/null +++ "b/tester/tool\360\237\226\211/clean_build_directories" @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# Caveat: the 'shell' directory is for built wrapper +# functions. `clean_build_directories` will remove all the files in this +# directory. For bespoke scripts used by the tester, put them in the `tool` +# directory. + +# input guards + env_must_be="tester/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + +# remove files + set -x + cd "$REPO_HOME"/tester + rm -r scratchpad/* + rm jvm/* + rm shell/* + set +x + +echo "$(script_fn) done." diff --git "a/tester/tool\360\237\226\211/env" "b/tester/tool\360\237\226\211/env" new file mode 100644 index 0000000..1c8ed7e --- /dev/null +++ "b/tester/tool\360\237\226\211/env" @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# input guards + + env_must_be="tool_shared/bespoke🖉/env" + error_bad_env=false + error_not_sourced=false + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + error_bad_env=true + fi + if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + echo "$script_afp:: This script must be sourced, not executed." + error_not_sourced=true + fi + if $error_not_sourced; then exit 1; fi + if $error_bad_env; then return 1; fi + +# so we can do testing + +export PATH=\ +"$REPO_HOME"/tester/tool/\ +:"$REPO_HOME"/tool_shared/bespoke/\ +:"$JAVA_HOME"/bin\ +:"$PATH" + +export CLASSPATH=\ +"$JAVA_HOME"/lib\ +:"$REPO_HOME"/release/"$PROJECT".jar\ +:"$REPO_HOME"/tester/jvm/Test_"$PROJECT".jar\ +:"$CLASSPATH" + +export SOURCEPATH=\ +"$REPO_HOME"/tester/javac/\ +:"$REPO_HOME"/developer/scratchpad/\ + + +# misc + + # make .githolder and .gitignore visible + alias ls="ls -a" + +# some feedback to show all went well + + export PROMPT_DECOR="$PROJECT"_tester + export ENV=$(script_fp) + echo ENV "$ENV" + cd "$REPO_HOME"/tester/ diff --git "a/tester/tool\360\237\226\211/make" "b/tester/tool\360\237\226\211/make" new file mode 100755 index 0000000..deae0a1 --- /dev/null +++ "b/tester/tool\360\237\226\211/make" @@ -0,0 +1,32 @@ +#!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# input guards + + env_must_be="tester/tool/env" + if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 + fi + +echo "Compiling files..." + + set -x + cd $REPO_HOME/tester + javac -g -d scratchpad javac/*.java + jar cf jvm/Test_"$PROJECT".jar -C scratchpad . + set +x + +echo "Creating shell wrappers..." + mkdir -p shell + # wrapper is a space separated list + wrapper=$(shell_wrapper_list) + for file in $wrapper;do + cat > shell/$file << EOL +#!/bin/env bash +java $file +EOL + chmod +x shell/$file + done + +echo "$(script_fp) done." diff --git "a/tester/tool\360\237\226\211/run_jdb" "b/tester/tool\360\237\226\211/run_jdb" new file mode 100755 index 0000000..9c472f4 --- /dev/null +++ "b/tester/tool\360\237\226\211/run_jdb" @@ -0,0 +1,12 @@ +#!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# input guards +env_must_be="tester/tool/env" +if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 +fi + +jdb -sourcepath "$SOURCEPATH" "$@" + diff --git "a/tester/tool\360\237\226\211/run_tests" "b/tester/tool\360\237\226\211/run_tests" new file mode 100755 index 0000000..1e7182b --- /dev/null +++ "b/tester/tool\360\237\226\211/run_tests" @@ -0,0 +1,23 @@ +#!/bin/env bash + +# Ensure REPO_HOME is set +if [ -z "$REPO_HOME" ]; then + echo "Error: REPO_HOME is not set." + exit 1 +fi + +# Navigate to the shell directory +cd "$REPO_HOME/tester/shell" || exit + +# Get the list of test scripts in the specific order from shell_wrapper_list +test_list=$(shell_wrapper_list) + +# Execute each test in the specified order +for file in $test_list; do + if [[ -x "$file" && ! -d "$file" ]]; then + echo -n "Running $file..." + ./"$file" + else + echo "Skipping $file (not executable or is a directory)" + fi +done diff --git "a/tester/tool\360\237\226\211/shell_wrapper_list" "b/tester/tool\360\237\226\211/shell_wrapper_list" new file mode 100755 index 0000000..29dd738 --- /dev/null +++ "b/tester/tool\360\237\226\211/shell_wrapper_list" @@ -0,0 +1,13 @@ +#!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# input guards +env_must_be="tester/tool/env" +if [ "$ENV" != "$env_must_be" ]; then + echo "$(script_fp):: error: must be run in the $env_must_be environment" + exit 1 +fi + +# space separated list of shell interface wrappers +echo Test0 Test_Util Test_IO Test_Testbench Test_MockClass_0 + diff --git a/tool_shared/bespoke/bashrc b/tool_shared/bespoke/bashrc deleted file mode 100644 index 0914cfc..0000000 --- a/tool_shared/bespoke/bashrc +++ /dev/null @@ -1,51 +0,0 @@ -# ssh login will fail if .bashrc writes to stdout, so we write to "bash_error.txt" -# set -x -# in F37 something seems to be caching PATH, which can be annoying - -# If not running interactively, don't do anything - case $- in - *i*) ;; - *) return;; - esac - -# This should also be the default from login.defs, because gnome ignores -# .login, .profile, etc. and uses systemd to launch applications from the desktop, - umask 0077 - -# - note the variable $PROMPT_DECOR, that is how the project name ends up in the prompt. -# - without -i bash will clear PS1, just because, so we set PPS1, ,PPS2 to not lose the profit. -# - use $(pwd) instead of \w or it will prefix '~' which confuses dirtrack when the -# user is changed using su - export PPS1='\n$($iseq/Z)[$PROMPT_DECOR]\n\u@\h§$(pwd)§\n> ' - export PPS2='>> ' - export PS1="$PPS1" - export PS2="$PPS2" - -# sort the output of printenv, show newlines as environment variable values as \n - alias printenv='printenv | awk '\''{gsub(/\n/, "\\n")}1'\'' | sort' - -# iso time in ls -l, show hidden files, human readable sizes - alias ls='ls -a -h --time-style=long-iso' - -# iso time for all Linux programs, which they will all ignore, but at least we -# tried, perhaps someday ... - export TZ=UTC - export TIME_STYLE=long-iso - export LC_ALL=en_DK.UTF-8 - -# -l don't truncate long lins -# -p show pids - alias pstree='pstree -lp' - -# - make bash gp to sleep, revealing the calling shell -# - useful for job control of multiple bash shells from a controlling shell - alias zzz="kill -STOP \$\$" - -# The one true operating system. -# Proof that an OS can be as small as an editor. - export EDITOR=emacs - -# check the window size after each command and, if necessary, update the values -# of LINES and COLUMNS. - shopt -s checkwinsize - diff --git a/tool_shared/bespoke/cat_w_fn b/tool_shared/bespoke/cat_w_fn deleted file mode 100755 index 3308525..0000000 --- a/tool_shared/bespoke/cat_w_fn +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") - -# Check if at least one file is provided -if [ $# -eq 0 ]; then - echo "Usage: $(script_fp) [filename2] ..." - exit 1 -fi - -# Loop through all the provided files -for file in "$@"; do - # Check if the file exists - if [ ! -f "$file" ]; then - echo "Error: File '$file' not found!" - continue - fi - - # Print 80 dashes - printf '%.0s-' {1..80} - echo - - # Print the filename and a colon - echo "$file:" - - # Print the contents of the file - cat "$file" - - # Print a newline for spacing between files - echo -done diff --git a/tool_shared/bespoke/deprecate b/tool_shared/bespoke/deprecate deleted file mode 100755 index 4713db5..0000000 --- a/tool_shared/bespoke/deprecate +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") - -# cp subtree at under file path , and make all the copied -# files read-only. The intended use case is for moving files to a `deprecated` -# directory. This helps prevent subsequent accidental editing. - -if [ "$#" -lt 2 ]; then - echo "Usage: $script_afp " - exit 1 -fi -SRC="$1" -DEST="$2" - -mkdir -p "$DEST" -mv "$SRC" "$DEST" - -# make stuff readonly -cd "$DEST" || exit -chmod -R u-w,go-rwx "$DEST" diff --git a/tool_shared/bespoke/emacs.el b/tool_shared/bespoke/emacs.el deleted file mode 100644 index 5ca4331..0000000 --- a/tool_shared/bespoke/emacs.el +++ /dev/null @@ -1,52 +0,0 @@ - -; The first time Emacs encounters a link to a source file, Emacs asks if it should follow it. -; This might suppress that initial question and follow the link. -; (setq find-file-visit-truename t) - -(defun jdbx () - "Set gud-jdb-sourcepath from the environment and run jdb with the correct source path." - (interactive) - (let* - ( - (sourcepath (getenv "SOURCEPATH")) - ) - (if - sourcepath - (setq gud-jdb-sourcepath (split-string sourcepath ":" t)) - (message "Warning: SOURCEPATH is not set. `jdb` will run without source path information.") - ) - (let - ( - (class-name (read-string "Enter the class to debug: " "Test_Util")) - ) - (jdb (concat "jdb -sourcepath" - (if - sourcepath - (mapconcat 'identity gud-jdb-sourcepath ":") "" - ) - " " - class-name - ) - )))) - -(defun monitor-jdb-sourcepath (output) - "Monitor the jdb output for `sourcepath ARG` commands and update `gud-jdb-sourcepath` with each path in ARG." - (when - (string-match "sourcepath \\(.+\\)" output) - (let* - ( - (new-paths (match-string 1 output)) - (paths-list (split-string new-paths ":" t)) - ) - ;; Add each path in paths-list to gud-jdb-sourcepath if not already present - (dolist - (path paths-list) - (unless - (member path gud-jdb-sourcepath) - (setq gud-jdb-sourcepath (append gud-jdb-sourcepath (list path))) - ) - ) - (message "Updated gud-jdb-sourcepath: %s" gud-jdb-sourcepath))) - output) - -(add-hook 'gud-filter-functions 'monitor-jdb-sourcepath) diff --git a/tool_shared/bespoke/env b/tool_shared/bespoke/env deleted file mode 100644 index 516d14d..0000000 --- a/tool_shared/bespoke/env +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") -if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then - echo "$script_afp:: This script must be sourced, not executed." - exit 1 -fi - -# -------------------------------------------------------------------------------- -# project definition - -# actual absolute directory path for this script file - - script_adp(){ - dirname "$script_afp" - } - -# assume this script is located $REPO_HOME/tools_shared/bespoke and work backwards -# to get $REPO_HOME, etc. - - REPO_HOME=$(dirname "$(dirname "$(script_adp)")") - echo REPO_HOME "$REPO_HOME" - - PROJECT=$(basename "$REPO_HOME") - echo PROJECT "$PROJECT" - - # set the prompt decoration to the name of the project - PROMPT_DECOR=$PROJECT - -# -------------------------------------------------------------------------------- -# The project administrator sets up the following tools for all roles to use: -# - export JAVA_HOME="$REPO_HOME/tool_shared/third_party/jdk-11" - -# -------------------------------------------------------------------------------- -# the following functions are provided for other scripts to use. -# at the top of files that make use of these functions put the following line: -# script_afp=$(realpath "${BASH_SOURCE[0]}") -# - - ## script's filename - script_fn(){ - basename "$script_afp" - } - - ## script's dirpath relative to $REPO_HOME - script_fp(){ - realpath --relative-to="${REPO_HOME}" "$script_afp" - } - - ## script's dirpath relative to $REPO_HOME - script_dp(){ - dirname "$(script_fp)" - } - -# -------------------------------------------------------------------------------- -# Exports -# Bash has no 'closure' hence when exporting a function, one must also export all the pieces. -# do not export script_afp - - export REPO_HOME PROJECT PROMPT_DECOR - export -f script_adp script_fn script_dp script_fp - - export ENV=$(script_fp) - echo ENV "$ENV" - diff --git a/tool_shared/bespoke/githolder b/tool_shared/bespoke/githolder deleted file mode 100755 index 49fb12b..0000000 --- a/tool_shared/bespoke/githolder +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/env /bin/bash - -# Description: Descends from $1, or pwd, looking for empty directories and adds a `.githolder` to them. -# does not descend into hidden directories. - -# examples: -# > git_holder -# > git_holder --dry-run - -set -e - -find_empty_dirs() { - local dir="$1" - local dry_run="$2" - - # Skip `.git` specifically - if [[ "$(basename "$dir")" == ".git" ]]; then - return - fi - - # Check if the directory is empty (including hidden files, excluding `.` and `..`) - if [[ -z $(find "$dir" -mindepth 1 -maxdepth 1 -print -quit) ]]; then - if [[ "$dry_run" == "true" ]]; then - echo "Dry-run: Would add .githolder in $dir" - else - echo "Adding .githolder to $dir" - touch "$dir/.githolder" - fi - else - # Recurse into subdirectories - for subdir in "$dir"/*/ "$dir"/.[!.]/; do - if [[ -d "$subdir" && "$subdir" != "$dir/.[!.]/" ]]; then - find_empty_dirs "$subdir" "$dry_run" - fi - done - fi -} - -# Default parameters -dry_run="false" -target_dir="." - -# Parse arguments -while [[ $# -gt 0 ]]; do - case "$1" in - --dry-run) - dry_run="true" - shift - ;; - *) - if [[ -d "$1" ]]; then - target_dir="$1" - shift - else - echo "Invalid argument: $1 is not a directory" - exit 1 - fi - ;; - esac -done - -# Run the function -find_empty_dirs "$target_dir" "$dry_run" diff --git a/tool_shared/bespoke/test_env b/tool_shared/bespoke/test_env deleted file mode 100755 index 18d75f9..0000000 --- a/tool_shared/bespoke/test_env +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") - -# try both running and sourcing this test - -echo -echo "--------------------------------------------------------------------------------" -echo "from within test_shared/bespoke/test_env:" -echo -echo "REPO_HOME:" "$REPO_HOME" -echo "PROJECT:" "$PROJECT" -echo "script_afp:" "$script_afp" -echo "script_adp:" "$(script_adp)" -echo "script_fn:" "$(script_fn)" -echo "script_fp:" "$(script_fp)" -echo "script_dp:" "$(script_dp)" -echo "ENV:" "$ENV" -echo "-----------------------" -echo "the BASH_SOURCE stack:" - - top_index=$(( ${#BASH_SOURCE[@]} - 1 )) - for (( i=0; i<=top_index; i++ )); do - echo "$i: ${BASH_SOURCE[$i]}" - done diff --git a/tool_shared/bespoke/version b/tool_shared/bespoke/version deleted file mode 100755 index d7fb222..0000000 --- a/tool_shared/bespoke/version +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") - -# 2024-10-24T14:56:09Z project skeleton and test bench files extracted from Ariadne -# 2024-11-08T07:18:03Z prefix `Mosaic_` to class names. See document/class_name.txt. -echo v1.1 - diff --git a/tool_shared/bespoke/vl b/tool_shared/bespoke/vl deleted file mode 100755 index 2c968d3..0000000 --- a/tool_shared/bespoke/vl +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") -# vl 'vertical list' - -# Check if the command is provided -if [ -z "$1" ]; then - echo "Usage: vl [args...]" - exit 1 -fi - -# Capture the command and its arguments -cmd=$1 -shift - -# Run the command with the remaining arguments and replace colons or spaces with newlines -"$cmd" "$@" | tr ' :' '\n' - -exit 0 diff --git a/tool_shared/bespoke/wipe_release b/tool_shared/bespoke/wipe_release deleted file mode 100755 index 5bac0e7..0000000 --- a/tool_shared/bespoke/wipe_release +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -script_afp=$(realpath "${BASH_SOURCE[0]}") -# remove all files in the release directory -set -e - -script_name=$(basename ${BASH_SOURCE[0]}) -if [ -z "$REPO_HOME" ]; then - echo "$script_name:: REPO_HOME is not set." - exit 1 -fi - -set -x -cd "$REPO_HOME" -rm -rf release/* -set +x - -echo "$script_name done." - diff --git "a/tool_shared/bespoke\360\237\226\211/env" "b/tool_shared/bespoke\360\237\226\211/env" new file mode 100644 index 0000000..6efefc2 --- /dev/null +++ "b/tool_shared/bespoke\360\237\226\211/env" @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") +if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + echo "$script_afp:: This script must be sourced, not executed." + exit 1 +fi + +# -------------------------------------------------------------------------------- +# project definition + +# actual absolute directory path for this script file + + script_adp(){ + dirname "$script_afp" + } + +# assume this script is located $REPO_HOME/tools_shared/bespoke and work backwards +# to get $REPO_HOME, etc. + + REPO_HOME=$(dirname "$(dirname "$(script_adp)")") + echo REPO_HOME "$REPO_HOME" + + PROJECT=$(basename "$REPO_HOME") + echo PROJECT "$PROJECT" + + # set the prompt decoration to the name of the project + PROMPT_DECOR=$PROJECT + +# -------------------------------------------------------------------------------- +# The project administrator sets up the following tools for all roles to use: +# + export PATH="$REPO_HOME/tool_shared/third_party/RT-incommon/release/bash:$PATH" + export PATH="$REPO_HOME/tool_shared/third_party/RT-incommon/release/amd64:$PATH" + export JAVA_HOME="$REPO_HOME/tool_shared/third_party/jdk-23.0.1:$PATH" + export PATH="$REPO_HOME/tool_shared/third_party/emacs/bin:$PATH" +# export PATH="$REPO_HOME/tool_shared/third_party/idea-IC-243.21565.193/:$PATH" + +# -------------------------------------------------------------------------------- +# the following functions are provided for other scripts to use. +# at the top of files that make use of these functions put the following line: +# script_afp=$(realpath "${BASH_SOURCE[0]}") +# + + ## script's filename + script_fn(){ + basename "$script_afp" + } + + ## script's dirpath relative to $REPO_HOME + script_fp(){ + realpath --relative-to="${REPO_HOME}" "$script_afp" + } + + ## script's dirpath relative to $REPO_HOME + script_dp(){ + dirname "$(script_fp)" + } + +# -------------------------------------------------------------------------------- +# Exports +# Bash has no 'closure' hence when exporting a function, one must also export all the pieces. +# do not export script_afp + + export REPO_HOME PROJECT PROMPT_DECOR + export -f script_adp script_fn script_dp script_fp + + export ENV=$(script_fp) + echo ENV "$ENV" + diff --git "a/tool_shared/bespoke\360\237\226\211/version" "b/tool_shared/bespoke\360\237\226\211/version" new file mode 100755 index 0000000..d7fb222 --- /dev/null +++ "b/tool_shared/bespoke\360\237\226\211/version" @@ -0,0 +1,7 @@ +#!/bin/env bash +script_afp=$(realpath "${BASH_SOURCE[0]}") + +# 2024-10-24T14:56:09Z project skeleton and test bench files extracted from Ariadne +# 2024-11-08T07:18:03Z prefix `Mosaic_` to class names. See document/class_name.txt. +echo v1.1 + diff --git "a/tool_shared/document\360\237\226\211/#install_java.txt#" "b/tool_shared/document\360\237\226\211/#install_java.txt#" deleted file mode 100644 index 0091eac..0000000 --- "a/tool_shared/document\360\237\226\211/#install_java.txt#" +++ /dev/null @@ -1,11 +0,0 @@ - -#1. downlaod - -cd "$REPO_HOME/tool/upstream" -curl -C - -o OpenJDK11U-jdk_x64_linux_hotspot_11.0.16_8.tar.gz https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.16+8/OpenJDK11U-jdk_x64_linux_hotspot_11.0.16_8.tar.gz - -#2. extract - -cd "$REPO_HOME/tool" -mkdir -p jdk-11 -tar -xzf "$REPO_HOME/tool/upstream/OpenJDK11U-jdk_x64_linux_hotspot_11.0.16_8.tar.gz" -C jdk-11 --strip-components 1 diff --git "a/tool_shared/document\360\237\226\211/install.txt" "b/tool_shared/document\360\237\226\211/install.txt" index 543d228..a6df14c 100644 --- "a/tool_shared/document\360\237\226\211/install.txt" +++ "b/tool_shared/document\360\237\226\211/install.txt" @@ -16,7 +16,7 @@ This pulls in documents and commonly used scripts. The project has symbolic link into RT-icommon, so this is not optional. cd "$REPO_HOME/tool_shared/third_party/" - git clone https://github.com/Thomas-Walker-Lynch/resource.git + git clone https://github.com/Thomas-Walker-Lynch/RT-incommon.git ln -s "$REPO_HOME/tool_shared/third_party/resource/document" see_also ---------------------------------------- @@ -37,7 +37,12 @@ jdk-23 ---------------------------------------- IDE -This is not strictly necessary, but a local install of an IDE will assure it is +See +$REPO_HOME/tool_shared/document/install_emacs.txt +$REPO_HOME/tool_shared/document/install_IntelliJ_IDEA.txt + + +but a local install of an IDE will assure it is sync with the rest of the project build for configuration files and tools built in to it. diff --git "a/tool_shared/document\360\237\226\211/install_Eclipse_hints.txt" "b/tool_shared/document\360\237\226\211/install_Eclipse_hints.txt" new file mode 100644 index 0000000..167d14e --- /dev/null +++ "b/tool_shared/document\360\237\226\211/install_Eclipse_hints.txt" @@ -0,0 +1,22 @@ + +The project is originally configured to be used with Emacs as an IDE. The tools +can all be run from a shell inside of emacs. Even when using an IDE what the +shell environment scripts and tools do should be understood. + +I have added a working IntelliJ IDEA configuration, so if you want a modern IDE +it is probably best to go with this. See ItelliJ_IDEA.txt in this directory. + +I've not run Eclipse on the project, if you do, perhaps you can update the notes +here. These things will probably increase your odds of making it work: + 1. open a shell + 2. cd to Ariadne, and source the env_developer + 3. run the tool 'distribute_source' + 3. run eclipse from the command line + 4. give eclipse the 'scratchpad' directory as its source + +Be sure to run `release` after development to update what the tester sees. + +Do the analogous steps if you contribute as a 'tester'. I.e. from +the shell source env_tester instead. Also, you will need to add +distribute_source to tester/tool, as it is currently not there. + diff --git "a/tool_shared/document\360\237\226\211/install_IntelliJ_IDEA.txt" "b/tool_shared/document\360\237\226\211/install_IntelliJ_IDEA.txt" new file mode 100644 index 0000000..82b21cc --- /dev/null +++ "b/tool_shared/document\360\237\226\211/install_IntelliJ_IDEA.txt" @@ -0,0 +1,252 @@ + +This file describes the local install and configuration of IntelliJ_IDEA for +the Ariadne project. + +The project was/is originally configured to be used with Emacs as an IDE. The tools +can all be run from a shell inside of emacs. Even when using an IDE what the +shell environment scripts and tools do should be understood. + +-------------------------------------------------------------------------------- +Some notes + +'project directory' - the directory with the .git file in it. Called $REPO_HOME in + RT scripts. Called $PROJECT_DIR$ (doesn't seem to be reliable) in IntelliJ + file paths. + +'module directory' - for RT projects examples include `~/Ariadne/developer' + `~/Ariadne/tester`. These are independent build environments. + + Careful, if Intellij scans directories it will not hesitate to pull things + from `tool_shared`/third_party or wherever else it finds things, and it will + make a big mess. + +IntelliJ paths on forms: + + I tried using $PROJECT_DIR$ as a variable standing for the project directory, + as this was suggested by an AI. However IntelliJ simply made a directory + with the literal variable name. + + Also tried using $REPO_HOME, as that was defined in the environment IntelliJ was run from. + It had the same effect as $PROJECT_DIR$. + + It will work with `~` for the home directory. So I have been using + `~/Ariadne/...` when typing out paths. + + There will be a browser icon at the right of a form entry boxes that take + paths. The browser tool starts from either /home or at / rather than at the + project. It inserts absolute path names. + +A GUI bug: + + There is a Gnome Linux bug where the drop down menu can stay on top no matter + what other window, application, or what virtual desktop a person is on. You + must go back to the IDEA application window and hit to make it go + away. + +The [OK] button at the bottom of dialogs: + + This closes the dialog. + + To apply changes hit [Apply]. + + [OK] will not save what is on the dialog if [Apply] would fail, but + it still closes it. + +-------------------------------------------------------------------------------- +To install ItelliJ + + Download the tar file from + `https://www.jetbrains.com/idea/download/?section=linux` + into the + `$REPO_HOME/tool_shared/third_party/upstream` + directory. + + Expand it into + `$REPO_HOME/tool_shared/third_party` + + cd into the expanded directory, into `bin`, then `chmod u+x` and run `idea_inst`. + + set the env path to include + `$REPO_HOME/tool_shared/third_party/idea-IC*/bin` + + The executable is called `idea`. + + Consider setting a desktop short cut. Consider instead installing it in your + own bin directory. Easily done, just move the directory created by the tar + file expansion there. + + I prefer a user mode install, as there is no reason this tool should need + admin privileges. + +-------------------------------------------------------------------------------- +Startup + + ./tool_shared/third_party/idea-IC-243.21565.193/bin/idea & + + Shows: Welcome screen + select "Open" as Ariadne already exists + + Shows: Open File or Project Browser + In top dialog box put full path to project directory. + + Hit [OK] at the bottom. Unlikely, but might be scrolled off the bottom of the screen. + + Shows: main window + Appears after hitting OK from the "Open File or Project" [ok]. + + Has a tool bar at the top. There is a double meat hamburger menu icon + at the left. Hitting this will replace the top bar with a vertical + menu for drop down menus. + + Careful, after the hamburger icon is pressed, the first drop down + menu instantly appears. Slide over to get the other drop downs. + Don't click, slide! + + Under tool bar: + Far left is an icon bar. Then a file browser. And then a big box + describing hot keys. + +-------------------------------------------------------------------------------- +Configuration + +If you cloned the Ariadne project, the modules will already be configured, and +also probably some of the run configuration will already be configured. + + ------------- + Setup Project + Hamburger icon > File dop-down > Project Structure > Project + + select project SDK from disk: + ~/Ariadne/tool_shared/third_party/jdk-11 + + ------------- + Setup Modules + + Hamburger icon > File dop-down > Project Structure > Modules + + Shows: "Project Structure" dialog + + Hit the '+' option that shows at the top of the second panel. + + New Module. + + Dialog pop-up + + Name: developer + + Location: (browse to the developer directory) + + alternatively enter the full path, ~/Ariadne, e.g. + + $PROJECT_DIR$ instead of, ~/Ariadne, worked when + entering the first module, but not the second. + + Dependencies: + Select the "Project SDK" from the drop down. + + Careful, the module won't be made until hitting [Create] at the bottom. + + As far as I can tell you can't get this panel again, rather delete and add + a new module if you need to change the entries. + + Shows: "Project Structure" dialog, again, now the third panel with information about the + developer module. + Third panel shows three choices: [Source] [Paths] [Dependencies] + + [Sources] is already selected. + + With Sources there are two panels. + + In second panel, on right side, the module root should show at the top. + Under if it lists any sources, use the button at the far right of the + listing to x it out. + + The first panel now shows a file browser for the module. + + Select the `javac` directory with a single click. Then, and only + after, look immediately the directory lists and click on [Sources] + + "Source Folders" will now appear in the second panel. The + javac folder will be listed. + + hit: [apply] at the bottom (or the form will reset to defaults next time) + + + Slide over to [Paths] + Copmiler Output + select [Use Module Compile Output Path] + Output Path: $PROJECT_DIR$/developer/scratchpad + Test Path: $PROJECT_DIR$/developer/test + + leave the exclude output checkbox, that means to exclude from repo + and from indexing for search + + hit: [apply] at the bottom + + ------------- + To add an external tool, for example tester/tool/make: + + This is how we integrate the local tools. + + Note, even if a shell script runs then runs a java program, that jave program + was compiled with debug flags, and run in debug mode, it can't be debugged. It + won't stop at break points, etc. For that an 'application' must be added see + the next section. + + Hamburger> Run > edit configurations + Shows Run/Debug configurations dialog + Upper left hit '+' + Shows drop down + chose [Shell Script] second from bottom + Shows dialog, for example: + Name: tester make + Script Path: ~/Ariadne/tester/tool/make (better to chose with the browser tool) + Script Options: tester make + Working Directory: ~/Ariadne (location of the env source scripts that env_run uses) + Environment variabls: (none, env_run will source env_tester) + Interpreter: /bin/bash (left to default) + + ------------- + To add a program for debugging. + + Humburger > Run > edit configurations + Shows Run/Debug configurations dialog + Upper left hit '+' + Shows drop down + chose [Application] first choice + Shows dialog, for example: + Name: Test_Graph_0 + + next line are two boxes, they are not labeled, the defaults show: + [ module not specified ] [ -cp no module ] + I selected:: + [ java 11 SDk of 'tester' module] [ -cp tester ] + This can be confusing, as the modules are 'tester' and 'developer', but + here it asks for an SDK! Then the next box says it wants a class path, + but it wants a module name! + + next line one box, not labeled + [ main class [] ] + Note icon at right, it will give a list of class names, here in the tester module, + that have main calls, select one. + + next line, again not labeled + [ Program Arguments ] + Test_Graph_0 has no arguments so I left it blank. + + Working Directory: ~/Ariadne + + Environment Variables: + Left blank because the executable itself does not make use of any. I do + know at this point if variables set in the environment IDEA ran in are + inherited. + + 'Modify Options' with a drop down menu. (At the top right of the configuration dialog) + Scan down for the `Java` section. + Check: 'Do not build before run' + (To build this example, go to the Run menu and run `tester make'. Or run make directly + from a console prompt. Be sure to source env_tester first.) + + Next go to main window file browser, click on the file you want to debug, click on the line + to set a break point. Right click to get a menu, and + diff --git "a/tool_shared/document\360\237\226\211/install_emacs.txt" "b/tool_shared/document\360\237\226\211/install_emacs.txt" index 63c8d6b..e5e0527 100644 --- "a/tool_shared/document\360\237\226\211/install_emacs.txt" +++ "b/tool_shared/document\360\237\226\211/install_emacs.txt" @@ -1,19 +1,32 @@ +System requirements: + +dnf install libX11-devel libXpm-devel libjpeg-devel libpng-devel libtiff-devel +dnf install gtk3-devel giflib-devel gnutls-devel +dnf install ncurses-devel texinfo +dnf install libacl-devel libattr-devel libgccjit libgccjit-devel + +I gather this warning is unavaoidable? +"configure: WARNING: Your version of Gtk+ will have problems with" + # install and build script: cd "$REPO_HOME"/tool_shared/third_party -mkdir -p emacs/{src build bin} +mkdir -p emacs/{src,build,bin} +# We sought stability, and now this. What can I say? It has 'visual-wrap-prefix-mode'. pushd upstream -curl -L -O https://ftp.gnu.org/gnu/emacs/emacs-29.4.tar.gz +curl -L -O https://alpha.gnu.org/gnu/emacs/pretest/emacs-30.0.92.tar.xz popd -tar -xzf upstream/emacs-29.4.tar.gz -C emacs/src --strip-components=1 +tar -xf upstream/emacs-30.0.92.tar.xz -C emacs/src --strip-components=1 pushd emacs/src -/configure --prefix=emacs/build +./configure --prefix="$REPO_HOME"/tool_shared/third_party/emacs make -j$(nproc) -make install DESTDIR=../bin +make install +make clean popd -rm -r emacs/build +rm -r emacs/{src,build} +