UPB-FILS-SdE2 / questions

0 stars 1 forks source link

[rustyloader] Problems with the tests #121

Closed popescuatopg closed 3 months ago

popescuatopg commented 3 months ago

There seems to be a problem with the rustyloader tests. More specifically, with the ELFs created by the Makefile on the github runner. The entry point seems to be erroneous on multiple tests.

Testing (with bss ELF as example)

I have

  1. Run rustup target add i686-unknown-linux-gnu && sudo apt-get update && sudo apt-get -y install gcc-multilib
  2. Cloned the https://github.com/UPB-FILS-SdE2/devoir-4-tests.git repository locally and cd'ed into it
  3. Run cd inputs && make && cd .. to create all the ELFs
  4. Run cargo build --release
  5. Run ./run.sh bss
  6. Run ./verify.sh bss segments leading to no differences

I have also created a symlink from ${PWD}/target/i686-unknown-linux-gnu/release/rusty-loader to /home/codespace/.cargo/bin so that I can execute the app.

Using the command readelf -h bss | grep 'Entry point' locally leads to this output:

  Entry point address:               0x8048120

which is correct judging by the solutions/bss.segments:

Segments
# address size offset length flags
0 0x8048000 960 0x0 960 r-x
1 0x804a000 4096 0x0 0 rw-
Entry point 8048120
Base address 8048000

The local output from my rust app is correct, as well, since manually git diff'ing leads to:

image

Possible causes

I am not 100% sure what could lead to this, but I have some ideas:

  1. It could be that the toolchain installed on our codespaces isn't the same as the one running on the github runner, thus, when make compiles the .c programs on the runner, the entry point is different
  2. Still related to the first one, already installed toolchains could be a leading cause, which is in fact a problem because of the difference in Ubuntu versions between the github runner and our codespaces (which are based on an image given by the template)

Running lsb_release -a locally shows:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

While the runner runs 22.04:

image

popescuatopg commented 3 months ago

Update: manually modifying the jobs.run-autograding-tests.runs-on from ubuntu-latest to ubuntu-20.04 solves most of them. There's still an error on the qsort segments test:

image

But I reckon this is a problem on my side because of poorly written rust code

Also, if you do get to modifying the classroom.yml please also consider modifying the bss code test to have the setup command cd devoir-4-tests && timeout 5 ./run.sh bss instead of cd /devoir-4-tests && timeout 5 ./run.sh bss, because it errors out when navigating to devoir-4-tests from the root folder

popescuatopg commented 3 months ago

Update 2: Error with test no_perm code. It tries to cd into devoir-3-tests instead of devoir-4-tests

alexandruradovici commented 3 months ago

Update 2: Error with test no_perm code. It tries to cd into devoir-3-tests instead of devoir-4-tests

Fixed

alexandruradovici commented 3 months ago

Update: manually modifying the jobs.run-autograding-tests.runs-on from ubuntu-latest to ubuntu-20.04 solves most of them. There's still an error on the qsort segments test:

image

But I reckon this is a problem on my side because of poorly written rust code

Also, if you do get to modifying the classroom.yml please also consider modifying the bss code test to have the setup command cd devoir-4-tests && timeout 5 ./run.sh bss instead of cd /devoir-4-tests && timeout 5 ./run.sh bss, because it errors out when navigating to devoir-4-tests from the root folder

Fixed

alexandruradovici commented 3 months ago

The version of the grader should now run using ubuntu 20.04, thank you for pointing this.