Skip to content

Commit 46866df

Browse files
committed
File management and parser
1 parent 44d7d54 commit 46866df

File tree

15 files changed

+266
-26
lines changed

15 files changed

+266
-26
lines changed

.gitignore

Lines changed: 172 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,175 @@
3131
*.out
3232
*.app
3333

34-
build/
34+
build/
35+
36+
37+
env/
38+
out.bit
39+
# Byte-compiled / optimized / DLL files
40+
__pycache__/
41+
*.py[cod]
42+
*$py.class
43+
44+
# C extensions
45+
*.so
46+
47+
# Distribution / packaging
48+
.Python
49+
build/
50+
develop-eggs/
51+
dist/
52+
downloads/
53+
eggs/
54+
.eggs/
55+
lib/
56+
lib64/
57+
parts/
58+
sdist/
59+
var/
60+
wheels/
61+
share/python-wheels/
62+
*.egg-info/
63+
.installed.cfg
64+
*.egg
65+
MANIFEST
66+
67+
# PyInstaller
68+
# Usually these files are written by a python script from a template
69+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
70+
*.manifest
71+
*.spec
72+
73+
# Installer logs
74+
pip-log.txt
75+
pip-delete-this-directory.txt
76+
77+
# Unit test / coverage reports
78+
htmlcov/
79+
.tox/
80+
.nox/
81+
.coverage
82+
.coverage.*
83+
.cache
84+
nosetests.xml
85+
coverage.xml
86+
*.cover
87+
*.py,cover
88+
.hypothesis/
89+
.pytest_cache/
90+
cover/
91+
92+
# Translations
93+
*.mo
94+
*.pot
95+
96+
# Django stuff:
97+
*.log
98+
local_settings.py
99+
db.sqlite3
100+
db.sqlite3-journal
101+
102+
# Flask stuff:
103+
instance/
104+
.webassets-cache
105+
106+
# Scrapy stuff:
107+
.scrapy
108+
109+
# Sphinx documentation
110+
docs/_build/
111+
112+
# PyBuilder
113+
.pybuilder/
114+
target/
115+
116+
# Jupyter Notebook
117+
.ipynb_checkpoints
118+
119+
# IPython
120+
profile_default/
121+
ipython_config.py
122+
123+
# pyenv
124+
# For a library or package, you might want to ignore these files since the code is
125+
# intended to run in multiple environments; otherwise, check them in:
126+
# .python-version
127+
128+
# pipenv
129+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
130+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
131+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
132+
# install all needed dependencies.
133+
#Pipfile.lock
134+
135+
# poetry
136+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
137+
# This is especially recommended for binary packages to ensure reproducibility, and is more
138+
# commonly ignored for libraries.
139+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
140+
#poetry.lock
141+
142+
# pdm
143+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
144+
#pdm.lock
145+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
146+
# in version control.
147+
# https://pdm.fming.dev/#use-with-ide
148+
.pdm.toml
149+
150+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
151+
__pypackages__/
152+
153+
# Celery stuff
154+
celerybeat-schedule
155+
celerybeat.pid
156+
157+
# SageMath parsed files
158+
*.sage.py
159+
160+
# Environments
161+
.env
162+
.venv
163+
env/
164+
venv/
165+
ENV/
166+
env.bak/
167+
venv.bak/
168+
169+
# Spyder project settings
170+
.spyderproject
171+
.spyproject
172+
173+
# Rope project settings
174+
.ropeproject
175+
176+
# mkdocs documentation
177+
/site
178+
179+
# mypy
180+
.mypy_cache/
181+
.dmypy.json
182+
dmypy.json
183+
184+
# Pyre type checker
185+
.pyre/
186+
187+
# pytype static type analyzer
188+
.pytype/
189+
190+
# Cython debug symbols
191+
cython_debug/
192+
193+
# PyCharm
194+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
195+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
196+
# and can be added to the global gitignore or merged into this file. For a more nuclear
197+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
198+
#.idea/
199+
processors/
200+
*.fs
201+
out/
202+
*.bit
203+
teste.py
204+
temp/
205+
arquivos.txt

test_runner/file.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,28 @@ def read_file(name):
1414

1515
def read_files_in_dir(path):
1616
try:
17-
file = [read_file(file) for file in glob.glob(f"{path}/*.hex", recursive=True)]
18-
file.append(path)
19-
return file
17+
if path.endswith("/memory"):
18+
path = path[:-7] # Remove the '/memory' suffix
19+
print("path: ", path)
20+
files = []
21+
22+
file_test = []
23+
for entry in os.scandir(f"{path}/memory"):
24+
if entry.is_file() and entry.name.endswith(".hex"):
25+
file_test.append(read_file(entry.path))
26+
27+
file_answer = []
28+
for entry in os.scandir(f"{path}/reference"):
29+
if entry.is_file() and entry.name.endswith(".hex"):
30+
file_answer.append(read_file(entry.path))
31+
32+
print("Files in reference directory: ", [entry.path for entry in os.scandir(path) if entry.is_dir()])
33+
print("teste: ", file_test)
34+
print("resposta: ", file_answer)
35+
files.append(file_test)
36+
files.append(file_answer)
37+
files.append(path)
38+
return files
2039
except FileNotFoundError:
2140
print(f"Error: The directory '{path}' was not found.")
2241
return []

test_runner/testing_testes/hello1/not_memory/005-xor.hex

Lines changed: 0 additions & 4 deletions
This file was deleted.

test_runner/testing_testes/hello1/not_memory/006-sll.hex

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.text
2+
3+
.global _start;
4+
5+
_start:
6+
addi a1, zero, 5; # a1 = zero + 5
7+
8+
sw a1, 60(zero);
9+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.text
2+
3+
.global _start;
4+
5+
_start:
6+
addi a1, zero, 5; # a1 = zero + 5
7+
add a1, a1, a1;
8+
9+
sw a1, 60(zero);
10+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
00000005
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0000000A

test_runner/testing_testes/hello2/not_memory/007-slt.hex

Lines changed: 0 additions & 4 deletions
This file was deleted.

test_runner/testing_testes/hello2/not_memory/008-sltu.hex

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)