Skip to content

Commit

Permalink
updated ci for ruff and formatted files accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
QDucasse committed Nov 5, 2024
1 parent 08c7a90 commit 4a82084
Show file tree
Hide file tree
Showing 8 changed files with 507 additions and 450 deletions.
911 changes: 488 additions & 423 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions gigue/rimi/rimi_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ def build_epilogue(
# need for RA!
if contains_call:
# Overwrite the RA load with a load from the shadow stack
instructions.insert(
-1, RIMIIInstruction.lst(rd=RA, rs1=RIMI_SSP_REG, imm=0)
)
instructions.insert(-1, RIMIIInstruction.lst(rd=RA, rs1=RIMI_SSP_REG, imm=0))
# Insert the addi
instructions.insert(
-1, IInstruction.addi(rd=RIMI_SSP_REG, rs1=RIMI_SSP_REG, imm=8)
Expand Down
4 changes: 1 addition & 3 deletions gigue/trampoline.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def build(self) -> List[Instruction]:
# \__________

def generate(self) -> List[int]:
self.machine_code = [
instruction.generate() for instruction in self.instructions
]
self.machine_code = [instruction.generate() for instruction in self.instructions]
return self.machine_code

def generate_bytes(self) -> bytes:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,7 @@ def test_build_epilogue_execution(
current_pc = uc_emul.reg_read(UC_RISCV_REG_PC)
assert (
current_sp
== STACK_ADDRESS
+ (used_s_regs + local_var_nb + (1 if contains_call else 0)) * 8
== STACK_ADDRESS + (used_s_regs + local_var_nb + (1 if contains_call else 0)) * 8
)
assert current_pc == called_address if contains_call else RET_ADDRESS
uc_emul.emu_stop()
Expand Down
4 changes: 1 addition & 3 deletions toccata/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ def extract_from_dump(dump_file: str) -> DumpParsingData:
ret_address = int(line.split(":")[0], 16)
in_gigue_bin = False
if start_address == -1:
raise MissingAddressException(
"Start address was not found in the dump."
)
raise MissingAddressException("Start address was not found in the dump.")
if end_address == -1:
raise MissingAddressException("End address was not found in the dump.")
if ret_address == -1:
Expand Down
24 changes: 12 additions & 12 deletions toccata/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ def plot_all_call_nb_cycles(
call_positions[call_qualif]
+ nb_methods_positions[app_data["nb_methods_qualif"]],
math.ceil(
mean([
nb_cycle for nb_cycle in app_data["nb_cycles"] if nb_cycle != 0
])
mean(
[nb_cycle for nb_cycle in app_data["nb_cycles"] if nb_cycle != 0]
)
)
/ 1000,
color="blue",
Expand All @@ -360,9 +360,9 @@ def plot_all_call_nb_cycles(
+ nb_methods_positions[app_data["nb_methods_qualif"]]
+ 0.25,
math.ceil(
mean([
nb_cycle for nb_cycle in app_data["nb_cycles"] if nb_cycle != 0
])
mean(
[nb_cycle for nb_cycle in app_data["nb_cycles"] if nb_cycle != 0]
)
)
/ 1000,
color="red",
Expand Down Expand Up @@ -457,9 +457,9 @@ def plot_all_mem_nb_cycles(
mem_positions[mem_qualif]
+ nb_methods_positions[app_data["nb_methods_qualif"]],
math.ceil(
mean([
nb_cycle for nb_cycle in app_data["nb_cycles"] if nb_cycle != 0
])
mean(
[nb_cycle for nb_cycle in app_data["nb_cycles"] if nb_cycle != 0]
)
)
/ 1000,
color="blue",
Expand All @@ -475,9 +475,9 @@ def plot_all_mem_nb_cycles(
+ nb_methods_positions[app_data["nb_methods_qualif"]]
+ 0.25,
math.ceil(
mean([
nb_cycle for nb_cycle in app_data["nb_cycles"] if nb_cycle != 0
])
mean(
[nb_cycle for nb_cycle in app_data["nb_cycles"] if nb_cycle != 0]
)
)
/ 1000,
color="red",
Expand Down
4 changes: 1 addition & 3 deletions toccata/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,7 @@ def consolidate_logs(
os.makedirs(base_dir_name)
os.makedirs(run_dir_name)
# Base name
base_name: str = (
f"{run_dir_name}{formatted_date}_{config_name}-{run_number}"
)
base_name: str = f"{run_dir_name}{formatted_date}_{config_name}-{run_number}"
# Dump the config data
with open(f"{base_name}.config.json", "w") as outfile:
json.dump(config_data, outfile, indent=2, separators=(",", ": "))
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ deps =
mypy
commands =
pipenv install --dev
pipenv run ruff --fix .
pipenv run ruff check
pipenv run ruff format
pipenv run mypy gigue

0 comments on commit 4a82084

Please sign in to comment.