prosyslab-classroom / cs348-information-security

61 stars 10 forks source link

[Tip] If the result of `make test` doesn't change even if you change the solution #223

Closed m-spitfire closed 1 year ago

m-spitfire commented 1 year ago

Name: Murad Bashirov

Run make clean or delete the files in _build/default/test/*.output then re-run the test command, for some reason dune doesn't re-run the command to re-generate the output files to check diff, but uses the old files.

ICubE- commented 1 year ago

Temporarily, you can edit Makefile. Make all: to all: clean and it will automatically clean and re-make when you run make or make test.

KihongHeo commented 1 year ago

Hi Murad,

I don't understand what you mean. It works well in my implementation.

make clean
make test
// works well
ICubE- commented 1 year ago

@KihongHeo I expected that make would remove and remake test outputs automatically, without make clean.

KihongHeo commented 1 year ago

@ICubE- can you here write down your sequence of commands and error messages? or diagnostics?

m-spitfire commented 1 year ago

@KihongHeo without make clean I expected make test to run the tests on changed code.

Sequences:

make test
# test case doesn't pass
# so I change to code, now it's correct
make test
# test still doesn't pass because it used files generated on the previous invocation
sujin0529 commented 1 year ago

Hi,

We just solved this problem and updated the homework template. So from now on, students cloning homework template will not have the above-mentioned problems.

make test
# test case doesn't pass
# change the code correctly
make test
# test case pass

Additionally, this problem has no effect on grading. Sorry for the confusion.

Thanks.

m-spitfire commented 1 year ago

@sujin0529 can you also share the patch to update existing homework repos? Thanks.

sujin0529 commented 1 year ago

@m-spitfire You change the test/dune with this code.

(rule
 (deps caesar1-key.txt caesar1-plain.txt)
 (targets caesar1-enc.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../caesar enc %{deps}))))

(rule
 (alias runtest)
 (action
  (diff caesar1-enc.expected caesar1-enc.output)))

(rule
 (deps caesar1-key.txt caesar1-cipher.txt)
 (targets caesar1-dec.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../caesar dec %{deps}))))

(rule
 (alias runtest)
 (action
  (diff caesar1-dec.expected caesar1-dec.output)))

(rule
 (deps caesar1-enc.output)
 (targets caesar1-crack.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../caesar crack %{deps}))))

(rule
 (alias runtest)
 (action
  (diff caesar1-crack.expected caesar1-crack.output)))

(rule
 (deps caesar2-key.txt caesar2-plain.txt)
 (targets caesar2-enc.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../caesar enc %{deps}))))

(rule
 (alias runtest)
 (action
  (diff caesar2-enc.expected caesar2-enc.output)))

(rule
 (deps caesar2-key.txt caesar2-cipher.txt)
 (targets caesar2-dec.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../caesar dec %{deps}))))

(rule
 (alias runtest)
 (action
  (diff caesar2-dec.expected caesar2-dec.output)))

(rule
 (deps caesar2-enc.output)
 (targets caesar2-crack.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../caesar crack %{deps}))))

(rule
 (alias runtest)
 (action
  (diff caesar2-crack.expected caesar2-crack.output)))

(rule
 (deps caesar3-key.txt caesar3-plain.txt)
 (targets caesar3-enc.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../caesar enc %{deps}))))

(rule
 (alias runtest)
 (action
  (diff caesar3-enc.expected caesar3-enc.output)))

(rule
 (deps caesar3-key.txt caesar3-cipher.txt)
 (targets caesar3-dec.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../caesar dec %{deps}))))

(rule
 (alias runtest)
 (action
  (diff caesar3-dec.expected caesar3-dec.output)))

(rule
 (deps caesar3-enc.output)
 (targets caesar3-crack.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../caesar crack %{deps}))))

(rule
 (alias runtest)
 (action
  (diff caesar3-crack.expected caesar3-crack.output)))

(rule
 (deps substitution1-key.txt substitution1-plain.txt)
 (targets substitution1-enc.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../substitution enc %{deps}))))

(rule
 (alias runtest)
 (action
  (diff substitution1-enc.expected substitution1-enc.output)))

(rule
 (deps substitution1-key.txt substitution1-cipher.txt)
 (targets substitution1-dec.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../substitution dec %{deps}))))

(rule
 (alias runtest)
 (action
  (diff substitution1-dec.expected substitution1-dec.output)))

(rule
 (deps substitution2-key.txt substitution2-plain.txt)
 (targets substitution2-enc.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../substitution enc %{deps}))))

(rule
 (alias runtest)
 (action
  (diff substitution2-enc.expected substitution2-enc.output)))

(rule
 (deps substitution2-key.txt substitution2-cipher.txt)
 (targets substitution2-dec.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../substitution dec %{deps}))))

(rule
 (alias runtest)
 (action
  (diff substitution2-dec.expected substitution2-dec.output)))

(rule
 (deps substitution3-key.txt substitution3-plain.txt)
 (targets substitution3-enc.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../substitution enc %{deps}))))

(rule
 (alias runtest)
 (action
  (diff substitution3-enc.expected substitution3-enc.output)))

(rule
 (deps substitution3-key.txt substitution3-cipher.txt)
 (targets substitution3-dec.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../substitution dec %{deps}))))

(rule
 (alias runtest)
 (action
  (diff substitution3-dec.expected substitution3-dec.output)))

(rule
 (deps vigenere1-key.txt vigenere1-plain.txt)
 (targets vigenere1-enc.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../vigenere enc %{deps}))))

(rule
 (alias runtest)
 (action
  (diff vigenere1-enc.expected vigenere1-enc.output)))

(rule
 (deps vigenere1-key.txt vigenere1-cipher.txt)
 (targets vigenere1-dec.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../vigenere dec %{deps}))))

(rule
 (alias runtest)
 (action
  (diff vigenere1-dec.expected vigenere1-dec.output)))

(rule
 (deps vigenere2-key.txt vigenere2-plain.txt)
 (targets vigenere2-enc.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../vigenere enc %{deps}))))

(rule
 (alias runtest)
 (action
  (diff vigenere2-enc.expected vigenere2-enc.output)))

(rule
 (deps vigenere2-key.txt vigenere2-cipher.txt)
 (targets vigenere2-dec.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../vigenere dec %{deps}))))

(rule
 (alias runtest)
 (action
  (diff vigenere2-dec.expected vigenere2-dec.output)))

(rule
 (deps vigenere3-key.txt vigenere3-plain.txt)
 (targets vigenere3-enc.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../vigenere enc %{deps}))))

(rule
 (alias runtest)
 (action
  (diff vigenere3-enc.expected vigenere3-enc.output)))

(rule
 (deps vigenere3-key.txt vigenere3-cipher.txt)
 (targets vigenere3-dec.output)
 (action
  (with-stdout-to
   %{targets}
   (run ../vigenere dec %{deps}))))

(rule
 (alias runtest)
 (action
  (diff vigenere3-dec.expected vigenere3-dec.output)))

Thanks.

m-spitfire commented 1 year ago

Thanks, @sujin0529. I'll keep this issue open till the end of HW1 for anyone who faces the same problem.