Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

sudo apt-get install \
binutils-aarch64-linux-gnu \
binutils-mips-linux-gnu \
binutils-powerpc-linux-gnu \
dos2unix \
Expand Down
3 changes: 3 additions & 0 deletions backend/compilers/download.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
import argparse
import os
import platform
Expand Down Expand Up @@ -539,6 +540,8 @@ def download_wii_gc():

set_x(compiler_dir / "mwcceppc.exe")

(compiler_dir / "license.dat").touch()

shutil.rmtree(COMPILERS_DIR / group_id)

# copy in clean 1.2.5 for frank
Expand Down
2 changes: 1 addition & 1 deletion backend/coreapp/diff_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def diff(

if platform == DUMMY:
# Todo produce diff for dummy
return {}
return {"rows": ["a", "b"]}

try:
arch = asm_differ.get_arch(platform.arch or "")
Expand Down
61 changes: 34 additions & 27 deletions backend/coreapp/tests.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import tempfile
from time import sleep
from typing import Any, Callable, Dict, Optional
from unittest import skip, skipIf, skipUnless
from unittest import skip, skipIf
from unittest.mock import Mock, patch
from parameterized import parameterized

import responses
from django.contrib.auth.models import User
Expand All @@ -15,9 +16,6 @@

from coreapp.compiler_wrapper import CompilerWrapper
from coreapp.compilers import (
GCC272SN,
MWCC_20_72,
MWCC_20_79,
Compiler,
GCC281,
IDO53,
Expand All @@ -26,14 +24,15 @@
MWCPPC_24,
PBX_GCC3,
)
from coreapp.diff_wrapper import DiffWrapper
from coreapp.m2c_wrapper import M2CWrapper
from coreapp.platforms import N64, NDS_ARM9, PS1
from coreapp.views.scratch import compile_scratch_update_score
from coreapp.views.scratch import compile_scratch_update_score, diff_compilation
from .models.github import GitHubRepo, GitHubUser

from .models.profile import Profile
from .models.project import Project, ProjectFunction, ProjectImportConfig, ProjectMember
from .models.scratch import CompilerConfig, Scratch
from .models.scratch import Assembly, CompilerConfig, Scratch


def requiresCompiler(*compilers: Compiler) -> Callable[..., Any]:
Expand Down Expand Up @@ -523,27 +522,35 @@ def test_dummy_compiler(self) -> None:
len(result.elf_object), 0, "The compilation result should be non-null"
)

def test_all_compilers(self) -> None:
"""
Ensure that we can run a simple compilation for all available compilers
"""
for compiler in compilers.available_compilers():
# TODO get these working
if compiler in [GCC272SN]:
continue
if compiler.platform in [NDS_ARM9, PS1]:
continue

result = CompilerWrapper.compile_code(
compiler,
"",
"int func(void) { return 5; }",
"",
"func",
)
self.assertGreater(
len(result.elf_object), 0, "The compilation result should be non-null"
)
@parameterized.expand(input=[(c,) for c in compilers.available_compilers()]) # type: ignore
def test_all_compilers(self, compiler: Compiler) -> None:
"""
Ensure that we can run a simple compilation/diff for all available compilers
"""
result = CompilerWrapper.compile_code(
compiler,
"",
"int func(void) { return 5; }",
"",
"func",
)
self.assertGreater(
len(result.elf_object),
0,
"The compilation result should be non-null",
)

diff = DiffWrapper.diff(
Assembly(elf_object=result.elf_object),
compiler.platform,
"",
result.elf_object,
allow_target_only=True,
diff_flags=[],
)

self.assertTrue("rows" in diff)
self.assertGreater(len(diff["rows"]), 0)


class DecompilationTests(BaseTestCase):
Expand Down
14 changes: 13 additions & 1 deletion backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ django-stubs-ext = "^0.4.0"
django-stubs = "1.9.0"
djangorestframework-stubs = "^1.4.0"
types-requests = "^2.27.15"
parameterized = "^0.8.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down