Commit graph

28 commits

Author SHA1 Message Date
Anna Shaleva
2096ad6e81 *: remove io/ioutil uses
Close #1764.
2022-03-17 19:39:18 +03:00
AnnaShaleva
c35950206a vm: add test to check CLI UTF-8 compatibility 2022-02-18 19:20:50 +03:00
Anna Shaleva
e8ec820d2e vm: add unload command
When execution fails it's the only way to change the prompt showing the
last executed instruction. Example:

```
NEO-GO-VM > loadgo examples/engine/engine.go
READY: loaded 117 instructions
NEO-GO-VM 0 > run
Error: at instruction 3 (SYSCALL): failed to invoke syscall 805851437: syscall not found
NEO-GO-VM 8 > parse
Error: missing argument
NEO-GO-VM 8 > parse 123
Integer to Hex			7b
Integer to Base64		ew==
String to Hex			313233
String to Base64		MTIz

NEO-GO-VM 8 > unload
NEO-GO-VM > exit

```
2022-02-18 16:34:58 +03:00
Anna Shaleva
563c3a4baa vm: replace ishell with urfave/cli
Use github.com/chzyer/readline for readline capabilities (including
history and ANSI escape sequences handling).
2022-02-18 16:34:50 +03:00
Anna Shaleva
a9872063fe vm: refactor VM CLI tests as they take too long to pass
These tests are slow on Windows, so refactor them a bit and avoid the following
error:
```
--- FAIL: TestRunWithDifferentArguments (4.01s)
        cli_test.go:96:
                Error Trace:    cli_test.go:96
                                                                                cli_test.go:321
                Error:          command took too long time
                Test:           TestRunWithDifferentArguments
```
2022-02-10 18:04:16 +03:00
Evgeniy Stratonikov
ad65d1fa1f compiler: implement custom logic for go1.15
For some reason `foo.go` is interpreted as an http URL, and even if we
replace it with `./foo.go` there is an errors with file missing on disk.
Because `CompileWithOptions` should be able to compile file under any
circumstances, we allocate temporary directory base on version used to
compile a binary.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-21 17:43:28 +03:00
Evgeniy Stratonikov
25583f9aeb compiler: make pkg/interop a separate module
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:21:26 +03:00
Evgeniy Stratonikov
9871dc8f5a compiler: update x/tools package
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:21:26 +03:00
Evgeniy Stratonikov
e7a0ecb349 compiler: provide .go filename to Compile
First argument contains filename, thus we use '.go' suffix to
distinguish between directories and files.
Contract name should be provided in options.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:21:24 +03:00
Evgeniy Stratonikov
8af9c870b1 compiler: remove CompileWithDebugInfo
It is a simple wrapper over `CompileWithOptions` which we don't really
need. Custom options can be specified explicitly instead of using some
random default. This default was introduced in 1578904da, however tests
written there use `CompileWithOptions` and all other tests
pass on that commit even without this default.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:15:48 +03:00
Roman Khimov
299a7ea614 compiler: use CALLT for native contract calls, fix #2257 2021-12-10 11:58:50 +03:00
AnnaShaleva
c67d249a8d vm: fix cli tests
* Remove extra symbols during command execution.
* Fix test contract paths.
2021-12-01 11:14:29 +03:00
AnnaShaleva
aefb6f9fee *: fix tests failing due to path.Join usage
Solution:
Use `file/filepath` package to construct expected path. This package is OS-aware, see https://github.com/golang/go/issues/30616.
2021-11-29 11:11:09 +03:00
Anna Shaleva
6cdb701a9d vm: improve error message for (*executor).checkError
It is helpful if something goes wrong.
2021-11-29 11:09:39 +03:00
Evgeniy Stratonikov
51127b8918 vmcli: convert base64 string to address in parse
In application logs hashes are serialized as base64 so it is useful
to convert them back to address via `util convert`.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-29 14:55:10 +03:00
Anna Shaleva
693c376d21 vm: wait more for a test prog execution ending 2021-10-22 12:14:37 +03:00
Anna Shaleva
6da458365d vm CLI: allow to dump slots 2021-09-09 13:45:10 +03:00
Roman Khimov
6d074a96e9 *: make tests use TempDir(), fix #1319
Simplify things, drop TempFile at the same time (refs. #1764)
2021-08-26 17:29:40 +03:00
Evgeniy Stratonikov
e2910a7cb4 vm/cli: add public key -> address conversion, fix #2121
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-13 10:43:49 +03:00
Roman Khimov
0583f252ab *: create real temporary dirs and files in tests
Improve reliability.
2021-07-20 12:51:11 +03:00
Anna Shaleva
b14fc5da7c vm: increase waiting time for vm cli program 2021-06-01 16:29:08 +03:00
Anna Shaleva
e3611bfa4c vm, cli: allow to specify flags while loading VM 2021-05-28 12:07:41 +03:00
Roman Khimov
07cdbb815c *: drop unnecessary fmt.Sprintf uses
gosimple: S1039: unnecessary use of fmt.Sprintf
2021-05-12 18:29:39 +03:00
Anna Shaleva
14ade42101 core: remove System.Binary.[Serialize, Deserialize] syscalls
And move their tests to native StdLib.
2021-03-10 19:24:19 +03:00
Anna Shaleva
2c81fc8b8e *: upgrade tests to use T.Cleanup() 2021-03-01 17:08:00 +03:00
Evgenii Stratonikov
1d4d93b3eb vmcli: use manifest for method execution 2021-01-11 10:45:42 +03:00
Evgenii Stratonikov
76a6ddc3a4 vmcli/test: run shell after providing input
In some cases, `Run()` can read from input before we have written
anything to it.
2020-12-10 13:35:52 +03:00
Evgenii Stratonikov
33f13ab1c0 vmcli: add tests 2020-12-02 10:49:37 +03:00