diff options
| -rwxr-xr-x | test/os_dep/linux/test_env.aarch64l | bin | 0 -> 6168 bytes | |||
| -rwxr-xr-x | test/os_dep/linux/test_env.arml | bin | 0 -> 5608 bytes | |||
| -rw-r--r-- | test/os_dep/linux/test_env.c | 10 | ||||
| -rw-r--r-- | test/os_dep/linux/test_env.py | 36 | ||||
| -rwxr-xr-x | test/os_dep/linux/test_env.x86_32 | bin | 0 -> 5588 bytes | |||
| -rwxr-xr-x | test/os_dep/linux/test_env.x86_64 | bin | 0 -> 6312 bytes | |||
| -rwxr-xr-x | test/test_all.py | 6 |
7 files changed, 52 insertions, 0 deletions
diff --git a/test/os_dep/linux/test_env.aarch64l b/test/os_dep/linux/test_env.aarch64l new file mode 100755 index 00000000..19e97780 --- /dev/null +++ b/test/os_dep/linux/test_env.aarch64l Binary files differdiff --git a/test/os_dep/linux/test_env.arml b/test/os_dep/linux/test_env.arml new file mode 100755 index 00000000..c24d061e --- /dev/null +++ b/test/os_dep/linux/test_env.arml Binary files differdiff --git a/test/os_dep/linux/test_env.c b/test/os_dep/linux/test_env.c new file mode 100644 index 00000000..7b265561 --- /dev/null +++ b/test/os_dep/linux/test_env.c @@ -0,0 +1,10 @@ +#include<stdlib.h> +#include<stdio.h> + +int main(int argc, char** argv, char** envp) +{ + printf("argc %d\n", argc); + printf("argv[0] %s\n", argv[0]); + printf("argv[1] %s\n", argv[1]); + printf("envp[0] %s\n", envp[0]); +} diff --git a/test/os_dep/linux/test_env.py b/test/os_dep/linux/test_env.py new file mode 100644 index 00000000..a44d62c4 --- /dev/null +++ b/test/os_dep/linux/test_env.py @@ -0,0 +1,36 @@ +import os +import sys +from pdb import pm +from miasm2.analysis.binary import Container +from miasm2.analysis.sandbox import Sandbox_Linux_x86_32, Sandbox_Linux_x86_64,\ + Sandbox_Linux_arml, Sandbox_Linux_aarch64l + +if len(sys.argv) < 2: + print "Usage: %s <arch> ..." % sys.argv[0] + exit(0) + +arch = sys.argv[1] + +if arch == "x86_32": + sandbox = Sandbox_Linux_x86_32 +elif arch == "x86_64": + sandbox = Sandbox_Linux_x86_64 +elif arch == "arml": + sandbox = Sandbox_Linux_arml +elif arch == "aarch64l": + sandbox = Sandbox_Linux_aarch64l +else: + raise ValueError("Unsuported arch: %s" % arch) + +# Parse arguments +parser = sandbox.parser(description="ELF sandboxer") +parser.add_argument("filename", help="ELF Filename") +options = parser.parse_args(sys.argv[2:]) + +# Create sandbox +sb = sandbox(options.filename, options, globals()) + +# Run +sb.run() + +assert(sb.jitter.run is False) diff --git a/test/os_dep/linux/test_env.x86_32 b/test/os_dep/linux/test_env.x86_32 new file mode 100755 index 00000000..9f0f96bc --- /dev/null +++ b/test/os_dep/linux/test_env.x86_32 Binary files differdiff --git a/test/os_dep/linux/test_env.x86_64 b/test/os_dep/linux/test_env.x86_64 new file mode 100755 index 00000000..f9d78a1d --- /dev/null +++ b/test/os_dep/linux/test_env.x86_64 Binary files differdiff --git a/test/test_all.py b/test/test_all.py index 0a29d4d3..237f13c1 100755 --- a/test/test_all.py +++ b/test/test_all.py @@ -257,6 +257,12 @@ for script in ["win_api_x86_32.py", ]: testset += RegressionTest([script], base_dir="os_dep", tags=[TAGS['tcc']]) +for arch in ["x86_32", "x86_64", "arml", "aarch64l"]: + testset += RegressionTest(["test_env.py", arch, "test_env.%s" % arch, "-c", + "arg1", "-c", "arg2", "--environment-vars", + "TEST=TOTO", "--mimic-env"], + base_dir="os_dep/linux", tags=[TAGS['tcc']]) + ## Analysis testset += RegressionTest(["depgraph.py"], base_dir="analysis", products=[fname for fnames in ( |