rubyx/test/mains
Torsten Rüger b9bdc55059 A good start on the macro idea
I call it macro because it lets you insert basically arbitrary risc code into the ruby level. The way it works:
Reserve namespace X
map any X.some_call to a Mom instruction
by the name SomeCall
which must take the same args in constructor as given
And obviously produce whatever risc it wants
Hoping to rewrite builtin around this idea (with the existing Mom builtn instructions)
2019-08-25 14:40:59 +03:00
..
source block version of loop 2019-08-24 17:00:59 +03:00
helper.rb adds arm testing of same files 2018-06-24 17:10:39 +03:00
README.md Successfully interpret class methods 2019-02-27 09:48:21 +02:00
test_arm.rb Fix slot access for constants 2019-08-18 20:35:01 +03:00
test_interpreted.rb mains tests can include any code 2018-08-18 19:42:14 +03:00
test_new.rb A good start on the macro idea 2019-08-25 14:40:59 +03:00

Mains testing

Test methods by their output and exit codes (return, since it is the main).

There are only two tests here (lus one, see below), one for interpreter, one for arm. Both run the same tests. The actual ruby code that is run is in the source dir. Test methods are generated, one for each source file.

Files

File names follow [name,stdout,exitcode] joined by _ pattern. Stdout may be left blank, but exit code must be supplied.

Arm

Obviously the arm tests need an arm platform. This may be defined by ARM_HOST, eg for simulated ARM_HOST=localhost

Also port and user may be specified with ARM_PORT and ARM_USER , they default to 2222 and pi if left blank. SSH keys must be set up so no passwords are required (and the users private key may not be password protected)

Developing

Since the Framework always runs all tests, it is a little cumbersome for developing a single new test. Since all get run and it is slow.

To develop the next test, one can edit test_new.rb . Once it runs on the interpreter, move the changes to a source file and revert test_new changes.