dodona-edu / universal-judge

Universal judge for educational software testing
https://docs.dodona.be/en/tested
MIT License
9 stars 5 forks source link

Add TypeScript #553

Closed BrentBlanckaert closed 3 days ago

BrentBlanckaert commented 1 month ago

No modules are recognized. I suspect this has to do with things missing in the flake file. I have no idea why it can't find certain modules like fs or typescript. I added pkgs.typescript to my dependecies so I would atleast think typescript would be supported.

BrentBlanckaert commented 1 month ago

I was able to solve the problem. I get no errors anymore when running

nix develop
tsx solution.ts

solution.ts:

import * as fs from "fs";
import * as ts from "typescript";

const GLOBAL_VAR = "GLOBAL";

However when I run the following, I still face the same problem

nix develop
python -m tested -c exercise/simple-example/config.json

The configuration pointing to the same solution file and test suite is the same as in the global test.

BrentBlanckaert commented 1 month ago

When running anthing with tsx, I no longer get an error regarding unknown modules. However for the test_batch_compilation_no_fallback_runtime test I was forced to use tsc in the compilation function. Because of this change, other tests are failing again. tsc is suffering from the same problem where it can't find certain modules like fs and typescript. This also links back to the problem in my previous comment.

BrentBlanckaert commented 1 week ago

None of these are wrong for me. I don't get why tests are complaining about csharp.

jorg-vr commented 1 week ago

The test complains about FileNotFoundError: [Errno 2] No such file or directory: 'dotnet'

So it probably has something to do with the docker image. This is the C# part:

# C# dependencies
curl https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb --output packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
apt-get update
apt-get install -y --no-install-recommends dotnet-sdk-8.0

Some ideas

Potential cause: maybe the curl or apt-get install had connection issues when building the image. Resulting in a bad dotnet install. As the docker is reused instead of rebuilt as long as no changes are applied this might persist the bug. Potential solution: make some changes to the docker, to trigger a rebuild.

Potential cause: apt-get install -y --no-install-recommends dotnet-sdk-8.0 install a different version, potentially on a different location Potential solution: Google about changes to dotnet, with the error

Potential cause: dotnet is not properly added to the PATH Potential solution: Either figure out why it is no longer added to PATH and/or add it manually

Potential cause: Your added commands happening right before the dotnet install, make dtnet install fail Potential solution: Switch positions in docker file

BrentBlanckaert commented 1 week ago

The test complains about FileNotFoundError: [Errno 2] No such file or directory: 'dotnet'

So it probably has something to do with the docker image. This is the C# part:

# C# dependencies
curl https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb --output packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
apt-get update
apt-get install -y --no-install-recommends dotnet-sdk-8.0

Some ideas

Potential cause: maybe the curl or apt-get install had connection issues when building the image. Resulting in a bad dotnet install. As the docker is reused instead of rebuilt as long as no changes are applied this might persist the bug. Potential solution: make some changes to the docker, to trigger a rebuild.

Potential cause: apt-get install -y --no-install-recommends dotnet-sdk-8.0 install a different version, potentially on a different location Potential solution: Google about changes to dotnet, with the error

Potential cause: dotnet is not properly added to the PATH Potential solution: Either figure out why it is no longer added to PATH and/or add it manually

Potential cause: Your added commands happening right before the dotnet install, make dtnet install fail Potential solution: Switch positions in docker file

I just tried all of the above. Nothing seems to work. I also didn't find anything about new changes that could of broken it.

BrentBlanckaert commented 4 days ago

Okay, I think all we have to do is change the docker for Dodona before merging.