Commit Graph

24 Commits

Author SHA1 Message Date
dbalatoni13 fa8f3adb44 Refactor compilers in the backend (#1506)
* Subclass MWCCCompiler and add CompilerType instead of seperate bools

* Set the platform per platform specific compiler subclasses instead of per instance
2025-03-25 13:28:34 +09:00
Mark Street 3cfbcdeedc Pass 'mipsel' as arch to m2c for le mips arches (#1395) 2024-12-08 22:03:46 +00:00
ConorB 721a08ccdf Make exception_on_timeout production-compatible, add more timeouts (#653)
* Force exception_on_timeout to use spawn to make gunicorn happy

* black

* Have test_fpr_reg_names_output and test_giant_compilation test for success as opposed to a lack of output

* Refactor timeouts for:
- compiling
- decompiling
- assembling
- disassembling

* Move m2c timeout wrapper to prevent interfering with StringIO

* Increase default timeouts by an order of magnitude to investigate failing CI tests

* Add timeout scale factor, have CI timeouts be 10x default

Co-authored-by: ConorBobbleHat <c.github@firstpartners.net>
2023-01-15 01:28:48 +09:00
Alex Bates 3ee5b6e8c2 Use m2c/asm-differ dependencies instead subrepos (#624) 2022-12-30 11:55:03 +00:00
ConorB 560a3d4455 Implement timeouts for m2c and compiler invocations (#628)
As this title suggests, this PR caps the runtime for all compiler / m2c
calls. Currently, the timeout is five seconds for both.

There may well be a better place to put the compile timeout; as ever,
happy to change :)

Co-authored-by: ConorBobbleHat <ConorBobbleHat>
2022-12-26 19:44:44 +09:00
Ethan Roseman db03a48ef9 Revert the reversion of the updates (#459)
* Revert "Revert "Dep updates (#457)" (#458)"

This reverts commit eb43c51586.

* ci changes

* Update almost everything, fix issues

* add jest-environment-jsdom

* fix to mwcc debug info option

* remove frontend tests

* black

* remove eslint-plugin-testing-library

* Do db migration

Co-authored-by: Alex Bates <alex@nanaian.town>
2022-06-01 23:06:51 -04:00
Ethan Roseman eb43c51586 Revert "Dep updates (#457)" (#458)
This reverts commit 03ae189510.
2022-05-31 18:40:21 +09:00
Ethan Roseman 03ae189510 Dep updates (#457)
* Update python deps and remove extra stuff from mac compiler command

* git subrepo pull --force backend/asm_differ

subrepo:
  subdir:   "backend/asm_differ"
  merged:   "9b2b6ad5"
upstream:
  origin:   "https://github.com/simonlindholm/asm-differ"
  branch:   "main"
  commit:   "9b2b6ad5"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* git subrepo pull --force backend/mips_to_c

subrepo:
  subdir:   "backend/mips_to_c"
  merged:   "10184592"
upstream:
  origin:   "https://github.com/matt-kempster/mips_to_c"
  branch:   "master"
  commit:   "10184592"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* prep for mips_to_c -> m2c migration

* rename m2c directory

* update frontend deps
2022-05-31 18:33:26 +09:00
Ethan Roseman 6b1ee90acd Compiler/platform refactor (#396)
* foyst

* clang & agbcc

* more

* wii/gc

* more

* fix

* more

* references

* fixes

* CI fix

* nabbed em

* gcc2.7.2kmc

* meowp

* Tweak Dockerfile + other bits (#398)

* Tweak Dockerfile + other bits

* Capitalise

* Enable/disable compiler downloads via Environment variables

* appease black

* migration

* flags / presets in Compiler

* fixed tests

* /compilers

* mypy cheese

* upd8s

* name

* frontend goodness

* i18n

* cleaners

Co-authored-by: Mark Street <22226349+mkst@users.noreply.github.com>
Co-authored-by: Mark Street <streetster@gmail.com>
2022-03-14 02:33:19 +09:00
Mark Street 9bb8765df3 Use psyq assembler (#376)
* Add psyq4.0

* Add psyq4.3 -> gcc2.7.2-psyq migration

* re-adding changes I rebased away...

* fix typo

* Add -quiet to 2.6.3-mipsel and use simple cpp

* fixup PR comments

* ensure scratches with old psyq compilers use new compiler ids

* Appease black
2022-02-22 02:19:54 +09:00
Ethan Roseman eb7534be0d Black (#380)
* Initial format

* action

* git subrepo pull --force backend/asm_differ

subrepo:
  subdir:   "backend/asm_differ"
  merged:   "ee239a2b"
upstream:
  origin:   "https://github.com/simonlindholm/asm-differ"
  branch:   "main"
  commit:   "ee239a2b"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* git subrepo pull --force backend/mips_to_c

subrepo:
  subdir:   "backend/mips_to_c"
  merged:   "6704d61f"
upstream:
  origin:   "https://github.com/matt-kempster/mips_to_c"
  branch:   "master"
  commit:   "6704d61f"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* vscode

* fix

* .
2022-02-20 23:21:38 +09:00
Ethan Roseman 396683181d Revert "Update psyq compilers to use psyq assembler (#373)" (#375)
This reverts commit 173f85a5a3.
2022-02-19 04:53:09 +09:00
Mark Street 173f85a5a3 Update psyq compilers to use psyq assembler (#373) 2022-02-19 04:22:40 +09:00
Ethan Roseman 811aa89cc0 Update m2c and asm_differ, add support for decompiling ppc (#339)
* git subrepo pull --force backend/asm_differ

subrepo:
  subdir:   "backend/asm_differ"
  merged:   "1e73cd4"
upstream:
  origin:   "https://github.com/simonlindholm/asm-differ"
  branch:   "main"
  commit:   "1e73cd4"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* git subrepo pull --force backend/mips_to_c

subrepo:
  subdir:   "backend/mips_to_c"
  merged:   "46c55a0"
upstream:
  origin:   "https://github.com/matt-kempster/mips_to_c"
  branch:   "master"
  commit:   "46c55a0"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* Update asm_differ and mips_to_c integration, add support and test for ppc

* git subrepo pull --force backend/asm_differ

subrepo:
  subdir:   "backend/asm_differ"
  merged:   "76597c6"
upstream:
  origin:   "https://github.com/simonlindholm/asm-differ"
  branch:   "main"
  commit:   "76597c6"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"
2022-02-05 01:40:05 +09:00
Ethan Roseman 1a1639f214 Decompile endpoint (#302)
* work on decompile endpoint + refactoring

* Add decompile endpoint, tests, refactor tests a bit

* Fix winders
2022-01-08 11:04:07 +09:00
Ethan Roseman f929174399 Dummy compiler + better error handling and reporting (#246)
* Initial work on dummy compiler + better exception / error stuff

* mypy

* Add more dummy functionality, fix some error handling, and organize views

* Imports, suggestion

* force include the dummy compiler

* attempt to fix issues

* Fix docker?

* undo dumb

* suggestion

* sugg2

* Turn off sandbox on winders

* oops

* PR suggestions, a new test, cleanup

* mypy

* Front-end dummy compiler, logging fix

* new prod option that removes dummy

* Cleanup, fixes

* cleanup

* more cleanin

* PROD -> DUMMY_COMPILER, move dummy config out of fs

* DJANGO_LOG_LEVEL as environ setting

* fix Dockerfile

* suggestion

* dummy off
2021-12-26 20:30:21 +09:00
Zach Banks 97b110a1c9 When mips2c fails, include its error message in the initial source (#194)
* When mips2c fails, include its error message in the initial source

This changes `M2CWrapper` to throw an `M2CError` with the contents of
its error when it fails.

Also updated `logging` --> `logger` in `views.py`

* Refactor `source_code`/`default_source_code`

* git subrepo pull --force backend/mips_to_c

subrepo:
  subdir:   "backend/mips_to_c"
  merged:   "d4ec385"
upstream:
  origin:   "https://github.com/matt-kempster/mips_to_c"
  branch:   "master"
  commit:   "d4ec385"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

Co-authored-by: Ethan Roseman <ethteck@gmail.com>
2021-10-30 02:11:10 +09:00
Ethan Roseman bf1a8bed6d Backend stuffs (#190)
* Require and validate compiler on scratch creation (fixes #164)

* git subrepo pull backend/mips_to_c

subrepo:
  subdir:   "backend/mips_to_c"
  merged:   "67594e9"
upstream:
  origin:   "https://github.com/matt-kempster/mips_to_c"
  branch:   "master"
  commit:   "67594e9"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* git subrepo pull backend/asm_differ

subrepo:
  subdir:   "backend/asm_differ"
  merged:   "c379de7"
upstream:
  origin:   "https://github.com/simonlindholm/asm-differ"
  branch:   "main"
  commit:   "c379de7"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* Add max_score, remove original_context, compiler m2c flag

* Rename cc_opts to compiler_flags across the board (fixes #168)

* Rename cc_opts to compiler_flags across the board (fixes #168)

* PR comments, squash migrations
2021-10-26 21:14:48 +09:00
alex 4e8b07efaa Diff from label (#151)
* Backend changes to diff from label rather than 0, also possibly fix #109

* implement diff_label frontend & fix assemble_asm

* Log stack trace if asm-differ fails

* don't return { obj } from api

* slight change in stub func code

* GET /compilers returns arches for compilers

* GET /compilers returns arches for compilers

* keep compiler_ids

* Obtain ido from download script, add comment for permuter api support

* Clean m2c wrapper code, add left pointer style, add test

* fix 3 tests

* list arches from api

* fix cookies in DEBUG

SameSite=None is incompatible with Secure, and this causes some browsers
to ignore the cookie altogether.

* fix test

Regression due to changing API to not return { "user": User } but
rather just the User object itself.

* fix create scratch without glabel

This works around a backend bug

* add label select on scratch creation

* show compilers/presets for current arch only

- fixes #92
- fixes #132

* fix mypy issues

* arch on scratch

* use .env.local instead of local.env

* fix unset compiler not considering arch

* fix compiler opts not displaying on first load if compiler is not gcc 2.8.1

Co-authored-by: Ethan Roseman <ethteck@gmail.com>
2021-10-12 00:59:33 +09:00
Zach Banks c05d7f07a0 Add mypy type checking (#100)
* Add mypy type checking

* PR Feedback

- Remove TODO-stubbed code
- Annotate `*args` as `str`s
- Push `Optional[str] --> ""` into callers
2021-08-26 14:49:33 -04:00
Zach Banks e3f92a5fc5 Make sandbox easier to configure
- Read `USE_SANDBOX_JAIL` from `.env`
- Rename `SandboxWrapper` -> `Sandbox`
- Remove `--user`/`--group` from `nsjail` wrapper
- Refactor `Dockerfile` to build nsjail
2021-08-11 13:52:39 -04:00
Zach Banks 8281dd3a57 Run compiler commands in an nsjail 2021-08-10 23:11:14 -04:00
Ethan Roseman b6f34bc754 Compiler configuration refactor, CHANGELOG, etc 2021-08-08 21:00:03 +09:00
Ethan Roseman 98ab1915af mips_to_c integration 2021-07-20 20:25:20 +09:00