Skip to content

Commit 6fbc101

Browse files
Fix typos and bugs in scripts (#11)
1 parent 32360d7 commit 6fbc101

6 files changed

Lines changed: 25 additions & 26 deletions

File tree

ci/coding_guidelines_check.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55
#
66
import argparse
7-
import re
87
from pathlib import Path
98
import re
109
import shlex
@@ -39,7 +38,7 @@
3938

4039
def locate_command(command: str) -> bool:
4140
if not shutil.which(command):
42-
print(f"Command '{command}'' not found")
41+
print(f"Command '{command}' not found")
4342
return False
4443

4544
return True

tests/fuzz/wasm-mutator-fuzz/server/app/main.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def to_json(inst, cls):
7272

7373

7474
class Fuzzing(db.Model):
75-
__tablename__ = 'fazzing_task'
75+
__tablename__ = 'fuzzing_task'
7676
id = db.Column(db.Integer, autoincrement=True,
7777
primary_key=True, nullable=False)
7878
repo = db.Column(db.String(200), nullable=False, default='')
@@ -96,7 +96,7 @@ class TaskError(db.Model):
9696
__tablename__ = 'task_error'
9797
id = db.Column(db.Integer, autoincrement=True,
9898
primary_key=True, nullable=False)
99-
fazzing_id = db.Column(db.Integer, db.ForeignKey("fazzing_task.id"))
99+
fuzzing_id = db.Column(db.Integer, db.ForeignKey("fuzzing_task.id"))
100100
name = db.Column(db.String(200), nullable=False, default='')
101101
std_out = db.Column(db.Text, default='')
102102
data = db.Column(db.JSON)
@@ -119,9 +119,9 @@ def to_data(data):
119119

120120
def error_count(data):
121121
error = len(TaskError.query.filter(
122-
TaskError.fazzing_id == data.get('id'), TaskError.status.in_([1, 2])).all())
122+
TaskError.fuzzing_id == data.get('id'), TaskError.status.in_([1, 2])).all())
123123
end_error = len(TaskError.query.filter(
124-
TaskError.fazzing_id == data.get('id'), TaskError.status == 0).all())
124+
TaskError.fuzzing_id == data.get('id'), TaskError.status == 0).all())
125125
data['error'] = error
126126
data['end_error'] = end_error
127127
return data
@@ -159,11 +159,11 @@ def show_fuzz_list():
159159
id = data.get('id')
160160
if id:
161161
all_error = TaskError.query.filter(
162-
TaskError.fazzing_id == id).with_entities(TaskError.id, TaskError.fazzing_id,
162+
TaskError.fuzzing_id == id).with_entities(TaskError.id, TaskError.fuzzing_id,
163163
TaskError.create_time, TaskError.data,
164164
TaskError.name, TaskError.status,
165165
TaskError.update_time, TaskError.comment).order_by(TaskError.status.desc(), TaskError.update_time.desc(), TaskError.id.desc()).all()
166-
data_message = [{'id': error['id'], "fuzzing_id": error['fazzing_id'],
166+
data_message = [{'id': error['id'], "fuzzing_id": error['fuzzing_id'],
167167
"name": error['name'], "data": error['data'],
168168
'create_time': error['create_time'].strftime('%Y-%m-%d %H:%M:%S'),
169169
'update_time': error['update_time'].strftime('%Y-%m-%d %H:%M:%S'),
@@ -204,7 +204,7 @@ def New_fuzzing():
204204
# curd.set_error_status_to(list(map(lambda x: x.id, error_list)), db)
205205
# Fuzzing.query.filter_by(id=fuzz.id).delete()
206206
fuzz.data = {'error': "Clone repo Error"}
207-
db.commit()
207+
db.session.commit()
208208
return jsonify({"status": 0, "result": "", "msg": "Clone repo Error"})
209209

210210
wamr_path_parent = fuzz_dir.parent.parent
@@ -277,7 +277,7 @@ def scheduler_run_task():
277277

278278
for fuzz in fuzz_query:
279279
all_error = TaskError.query.filter(
280-
TaskError.fazzing_id == fuzz.id).with_entities(TaskError.name).all()
280+
TaskError.fuzzing_id == fuzz.id).with_entities(TaskError.name).all()
281281
fuzz_cmd = wasm_mutator_dir / \
282282
'workspace' / f'build_{fuzz.id}'
283283
dir_list = filter(lambda x: x.startswith(
@@ -287,7 +287,7 @@ def scheduler_run_task():
287287
for dir in dir_list:
288288
cmd = f'cd {fuzz_cmd} && ./wasm_mutator_fuzz {dir}'
289289
status, resp = getstatusoutput(cmd)
290-
task_error = TaskError(name=dir, std_out=resp, fazzing_id=fuzz.id,
290+
task_error = TaskError(name=dir, std_out=resp, fuzzing_id=fuzz.id,
291291
create_time=datetime.utcnow() + timedelta(hours=8))
292292
db.session.add(task_error)
293293
db.session.commit()
@@ -312,7 +312,7 @@ def get_error_txt():
312312
return jsonify({"status": 0, "results": [], 'msg': "Error"})
313313
error = TaskError.query.get(id)
314314
fuzz_cmd = wasm_mutator_dir / \
315-
'workspace' / f'build_{error.fazzing_id}'
315+
'workspace' / f'build_{error.fuzzing_id}'
316316
file_cmd = fuzz_cmd / error.name
317317

318318
response = send_file(file_cmd, as_attachment=True,
@@ -351,7 +351,7 @@ def get_cases_zip():
351351
with ZipFile(memory_file, "w", ZIP_DEFLATED) as zf:
352352
for task_error in task_query:
353353
fuzz_cmd = wasm_mutator_dir / \
354-
'workspace' / f'build_{task_error.fazzing_id}'
354+
'workspace' / f'build_{task_error.fuzzing_id}'
355355
file_cmd = fuzz_cmd / task_error.name
356356
zf.write(str(file_cmd), arcname=task_error.name)
357357
memory_file.seek(0)
@@ -399,7 +399,7 @@ def error_restart():
399399
if run_status:
400400
return jsonify({"status": 0, "results": [], 'msg': "There are already tasks in progress"})
401401
task_query = TaskError.query.filter(TaskError.id.in_(id_list)).all()
402-
fuzzing_id = task_query[0].fazzing_id
402+
fuzzing_id = task_query[0].fuzzing_id
403403
fuzz_cmd = wasm_mutator_dir / \
404404
'workspace' / f'build_{fuzzing_id}'
405405
restart_cmd = wasm_mutator_dir / \
@@ -412,7 +412,7 @@ def error_restart():
412412
if not Path(restart_cmd / 'wamr').exists():
413413
print('------ error: clone repo not folder exists ------')
414414
# fuzz.data = {'error': "Clone repo Error"}
415-
db.commit()
415+
db.session.commit()
416416
return jsonify({"status": 0, "result": "", "msg": "Clone repo Error"})
417417
wamr_path_parent = fuzz_dir.parent.parent
418418
wamr_path = wamr_path_parent / 'wamr'

tests/requirement-engineering/gc-aot/build_spec_interpreter.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ git apply ../../../wamr-test-suites/spec-test-script/gc_ignore_cases.patch
1717
# Set OCaml compiler environment
1818
eval $(opam config env)
1919

20-
echo "compile the reference intepreter"
20+
echo "compile the reference interpreter"
2121
pushd interpreter
2222
make
23-
popd
23+
popd

tests/standalone/test-running-modes/test_c_embed_api_thoroughly.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from collections import OrderedDict
1010

1111

12-
def CLI_ARGS_GENREATOR(running_modes_supported: list[str]) -> list[str]:
12+
def CLI_ARGS_GENERATOR(running_modes_supported: list[str]) -> list[str]:
1313
res = []
1414
list_2d = [["--default-running-mode={} --module-running-mode={}".format(i, j)
1515
for i in running_modes_supported] for j in running_modes_supported]
@@ -35,16 +35,16 @@ def main():
3535
]
3636

3737
# Python 3.7+: Dictionary iteration order is guaranteed to be in order of insertion.
38-
# just to be safe, using orderreddict
38+
# just to be safe, using OrderedDict
3939
# key: value -> compile mode, {"compile_flag": CMake compile flag, "iwasm_cli_args": array of CLI args tested}
4040
test_options = OrderedDict({
41-
"INTERP": {"compile_flag": COMPILE_FLAGS[0], "cli_args": CLI_ARGS_GENREATOR(RUNNING_MODES[:1])},
42-
"FAST_JIT": {"compile_flag": COMPILE_FLAGS[1], "cli_args": CLI_ARGS_GENREATOR(RUNNING_MODES[:2])},
41+
"INTERP": {"compile_flag": COMPILE_FLAGS[0], "cli_args": CLI_ARGS_GENERATOR(RUNNING_MODES[:1])},
42+
"FAST_JIT": {"compile_flag": COMPILE_FLAGS[1], "cli_args": CLI_ARGS_GENERATOR(RUNNING_MODES[:2])},
4343
"LLVM_JIT": {"compile_flag": COMPILE_FLAGS[2],
44-
"cli_args": CLI_ARGS_GENREATOR([RUNNING_MODES[0], RUNNING_MODES[2]])},
45-
"MULTI_TIER_JIT": {"compile_flag": COMPILE_FLAGS[3], "cli_args": CLI_ARGS_GENREATOR(RUNNING_MODES)},
44+
"cli_args": CLI_ARGS_GENERATOR([RUNNING_MODES[0], RUNNING_MODES[2]])},
45+
"MULTI_TIER_JIT": {"compile_flag": COMPILE_FLAGS[3], "cli_args": CLI_ARGS_GENERATOR(RUNNING_MODES)},
4646
"EAGER_JIT_WITH_BOTH_JIT": {"compile_flag": COMPILE_FLAGS[4],
47-
"cli_args": CLI_ARGS_GENREATOR(RUNNING_MODES[:3])}
47+
"cli_args": CLI_ARGS_GENERATOR(RUNNING_MODES[:3])}
4848
})
4949

5050
build_cmd = "./build_c_embed.sh \"{build_flag}\""

tests/standalone/test-running-modes/test_iwasm_thoroughly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def main():
2929
]
3030

3131
# Python 3.7+: Dictionary iteration order is guaranteed to be in order of insertion.
32-
# just to be safe, using orderreddict
32+
# just to be safe, using OrderedDict
3333
# key: value -> compile mode, {"compile_flag": CMake compile flag, "iwasm_cli_args": array of CLI args tested}
3434
test_options = OrderedDict({
3535
"INTERP": {"compile_flag": COMPILE_FLAGS[0], "iwasm_cli_args": IWASM_CLI_ARGS[:1]},

tests/wamr-test-suites/test_wamr.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ function setup_wabt()
414414

415415
function compile_reference_interpreter()
416416
{
417-
echo "compile the reference intepreter"
417+
echo "compile the reference interpreter"
418418
pushd interpreter
419419
make
420420
if [ $? -ne 0 ]

0 commit comments

Comments
 (0)