仿真平台内核初版 -tlib库 包含<sparc arm riscv powerPC>
This commit is contained in:
47
tools/models_analyzer/Scripts/installModelsCompare.sh
Executable file
47
tools/models_analyzer/Scripts/installModelsCompare.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# install ModelsCompare as a Python package, with runnable script
|
||||
|
||||
features=()
|
||||
options=()
|
||||
while getopts ":v-:" opt; do
|
||||
case $opt in
|
||||
v)
|
||||
features+=("validate")
|
||||
;;
|
||||
u)
|
||||
options+=("--user")
|
||||
;;
|
||||
-)
|
||||
case "$OPTARG" in
|
||||
validate)
|
||||
features+=("validate")
|
||||
;;
|
||||
user)
|
||||
options+=("--user")
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option: --$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
feature_string=$(IFS=, ; echo "${features[*]}")
|
||||
if [ -n "$feature_string" ]; then
|
||||
feature_string="[$feature_string]"
|
||||
fi
|
||||
|
||||
cd ModelsCompare/
|
||||
rm -r build dist *.egg-info src/*.egg-info 2> /dev/null || true
|
||||
if [ -n "$options" ]; then
|
||||
pip3 install "${options[*]}" ".$feature_string"
|
||||
else
|
||||
pip3 install ".$feature_string"
|
||||
fi
|
||||
7
tools/models_analyzer/Scripts/installRunner.sh
Executable file
7
tools/models_analyzer/Scripts/installRunner.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Install Runner as a global dotnet tool
|
||||
|
||||
cd ModelsAnalyzer/Runner
|
||||
dotnet pack --configuration Release
|
||||
dotnet tool update --global --add-source ./package RenodeAnalyzersRunner
|
||||
59
tools/models_analyzer/Scripts/simple_test_with_summary.py
Executable file
59
tools/models_analyzer/Scripts/simple_test_with_summary.py
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import click
|
||||
import subprocess
|
||||
import pathlib
|
||||
import shlex
|
||||
|
||||
DEBUG = False
|
||||
|
||||
@click.group()
|
||||
def group():
|
||||
pass
|
||||
|
||||
@group.command()
|
||||
@click.argument('cmd')
|
||||
@click.argument('dir')
|
||||
@click.argument('glob')
|
||||
@click.argument('onsuccess', required=False)
|
||||
def run_tests(**kwargs):
|
||||
dir = pathlib.Path(kwargs['dir'])
|
||||
|
||||
def expand_path(path: str):
|
||||
return pathlib.Path(path.format(file=str(elem.name), sfile=sfile, path=str(elem.parent))).expanduser()
|
||||
|
||||
failed = []
|
||||
total = 0
|
||||
for elem in dir.rglob(kwargs['glob']):
|
||||
if elem.is_file():
|
||||
print(f'+++++ {elem.name}')
|
||||
sfile = pathlib.Path(elem.name).stem.removesuffix('.cs-registersInfo')
|
||||
cmd = expand_path(kwargs['cmd'])
|
||||
|
||||
if DEBUG:
|
||||
print('Executing:', shlex.split(str(cmd)))
|
||||
|
||||
res = subprocess.run(shlex.split(str(cmd)), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8')
|
||||
|
||||
print(res.stdout)
|
||||
|
||||
if res.returncode != 0:
|
||||
failed.append(elem.name)
|
||||
print('++ FAILED')
|
||||
else:
|
||||
print('++ SUCCESS')
|
||||
if 'onsuccess' in kwargs and kwargs['onsuccess']:
|
||||
onsuccess = expand_path(kwargs['onsuccess'])
|
||||
res = subprocess.run(shlex.split(str(onsuccess)), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf-8')
|
||||
print(res.stdout)
|
||||
|
||||
total += 1
|
||||
sys.stdout.flush()
|
||||
|
||||
print(f'Failed tests {len(failed)}/{total}.')
|
||||
print('\n *'.join(sorted(failed)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
group()
|
||||
3
tools/models_analyzer/Scripts/uninstallModelsCompare.sh
Executable file
3
tools/models_analyzer/Scripts/uninstallModelsCompare.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
pip3 uninstall -y RenodeModelsCompare
|
||||
3
tools/models_analyzer/Scripts/uninstallRunner.sh
Executable file
3
tools/models_analyzer/Scripts/uninstallRunner.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
dotnet tool uninstall -g RenodeAnalyzersRunner
|
||||
Reference in New Issue
Block a user