Skip to content

Commit

Permalink
fix bug?
Browse files Browse the repository at this point in the history
  • Loading branch information
ethteck committed Sep 11, 2023
1 parent e81606b commit 7e558f3
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 27 deletions.
38 changes: 23 additions & 15 deletions backend/compilers/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,9 @@ def download_gc_wii():

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

if (COMPILERS_DIR / "gc_wii" / ver).exists():
shutil.rmtree(COMPILERS_DIR / "gc_wii" / ver)

# copy in clean 1.2.5 for frank
shutil.copy(
COMPILERS_DIR / "gc_wii" / "mwcc_233_163" / "mwcceppc.exe",
Expand Down Expand Up @@ -959,12 +962,23 @@ def download_n3ds():
shutil.move(COMPILERS_DIR / "n3ds" / group_id / ver, compiler_dir)

# Set +x to allow WSL without wine
exe_path = compiler_dir / "bin/armcc.exe"
set_x(exe_path)
set_x(compiler_dir / "bin/armcc.exe")
shutil.rmtree(COMPILERS_DIR / "n3ds" / group_id)


def download_msdos():
# Download some custom tools needed for watcom object format.
download_tar(
url="https://github.com/OmniBlade/binutils-gdb/releases/download/omf-build/omftools.tar.gz",
platform_id="msdos",
dest_name="i386_tools",
)

tools_dir = COMPILERS_DIR / "msdos" / "i386_tools"
set_x(tools_dir / "jwasm")
set_x(tools_dir / "omf-objdump")
set_x(tools_dir / "omf-nm")

for compiler in [
"wcc10.5",
"wcc10.5a",
Expand All @@ -981,20 +995,14 @@ def download_msdos():
platform_id="msdos",
dest_name=compiler,
)
shutil.copytree(
tools_dir,
COMPILERS_DIR / "msdos" / compiler / "i386_tools",
dirs_exist_ok=True,
)

# Download some custom tools needed for watcom object format.
download_tar(
url="https://github.com/OmniBlade/binutils-gdb/releases/download/omf-build/omftools.tar.gz",
platform_id="msdos",
dest_name="i386_tools",
)

exe_path = COMPILERS_DIR / "msdos" / "i386_tools/jwasm"
exe_path.chmod(exe_path.stat().st_mode | stat.S_IEXEC)
exe_path = COMPILERS_DIR / "msdos" / "i386_tools/omf-objdump"
exe_path.chmod(exe_path.stat().st_mode | stat.S_IEXEC)
exe_path = COMPILERS_DIR / "msdos" / "i386_tools/omf-nm"
exe_path.chmod(exe_path.stat().st_mode | stat.S_IEXEC)
if tools_dir.exists():
shutil.rmtree(tools_dir)


def download_win9x():
Expand Down
39 changes: 27 additions & 12 deletions backend/coreapp/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@
from typing import Any, Callable, Dict, Optional
from unittest import skip, skipIf
from unittest.mock import Mock, patch
from parameterized import parameterized

import responses
from django.contrib.auth.models import User
from django.test.testcases import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from coreapp.compilers import DummyCompiler
from coreapp.flags import Language
from coreapp.sandbox import Sandbox
from coreapp import compilers, platforms

from coreapp.compiler_wrapper import CompilerWrapper
from coreapp.compilers import (
Compiler,
GCC281PM,
IDO53,
IDO71,
MWCC_247_92,
PBX_GCC3,
WATCOM_105_C,
Compiler,
DummyCompiler,
)
from coreapp.diff_wrapper import DiffWrapper
from coreapp.flags import Language
from coreapp.m2c_wrapper import M2CWrapper
from coreapp.platforms import N64
from coreapp.sandbox import Sandbox
from coreapp.views.scratch import compile_scratch_update_score
from .models.github import GitHubRepo, GitHubUser
from django.contrib.auth.models import User
from django.test.testcases import TestCase
from django.urls import reverse
from parameterized import parameterized
from rest_framework import status
from rest_framework.test import APITestCase

from .models.github import GitHubRepo, GitHubUser
from .models.profile import Profile
from .models.project import Project, ProjectFunction, ProjectImportConfig, ProjectMember
from .models.scratch import Assembly, CompilerConfig, Scratch
Expand Down Expand Up @@ -497,6 +497,21 @@ def test_mwcc(self) -> None:
len(result.elf_object), 0, "The compilation result should be non-null"
)

@requiresCompiler(WATCOM_105_C)
def test_watcom_cc(self) -> None:
"""
Ensure that we can invoke watcom cc
"""
result = CompilerWrapper.compile_code(
WATCOM_105_C,
"",
"int func(void) { return 5; }",
"extern char libvar1;\r\nextern char libvar2;\r\n",
)
self.assertGreater(
len(result.elf_object), 0, "The compilation result should be non-null"
)

def test_dummy_compiler(self) -> None:
"""
Ensure basic functionality works for the dummy compiler
Expand Down

0 comments on commit 7e558f3

Please sign in to comment.