diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-25 19:54:38 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-25 19:54:38 +0200 |
| commit | 5a4de48a6d63cb383832f6ef85b21699a511b755 (patch) | |
| tree | 4c4fd18d26f8b5c95a6788d138ed62869357c975 /test/module | |
| parent | 1a99af129427275c22e8276e75fa4b8da6602129 (diff) | |
stubbing in a lot of stuff!
Diffstat (limited to 'test/module')
| -rwxr-xr-x | test/module/test.pl | 30 | ||||
| -rwxr-xr-x | test/module/test.py | 20 |
2 files changed, 50 insertions, 0 deletions
diff --git a/test/module/test.pl b/test/module/test.pl new file mode 100755 index 0000000..0853f79 --- /dev/null +++ b/test/module/test.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use Getopt::Long; +my $train; +my $test; +GetOptions ( + "train" => \$train, + "test" => \$test +) +or die("Error in command line arguments\n"); + +print "hello i am a perl script :o)\n"; + +if ($train) { + print "we are training...\n"; + for (my $i = 0; $i < 10; $i++) { + print "$i...\n"; + sleep 1; + } +} elsif ($test) { + print "we are testing...\n"; + for (my $i = 0; $i < 10; $i++) { + print "$i...\n"; + sleep 1; + } +} else { + die "unknown command!"; +} + +exit; diff --git a/test/module/test.py b/test/module/test.py new file mode 100755 index 0000000..a0b6493 --- /dev/null +++ b/test/module/test.py @@ -0,0 +1,20 @@ +import importlib.util +spec = importlib.util.spec_from_file_location("module.name", "../../rpc/__main__.py") +CortexRPC = importlib.util.module_from_spec(spec) +spec.loader.exec_module(CortexRPC) + +if __name__ == '__main__': + def get_params(key, value): + print('get params.') + return 'test' + def set_param(key, value): + print('log param. {}: {}'.format(key, value)) + return 'ok' + def ready: + return 'ready' + def process_cmd(cmd, payload): + print('process command', cmd, payload) + return 'processed' + + # this will block + rpc = CortexRPC(get_params, set_param, ready, process_cmd) |
