Message ID | 20220227135342.10296-9-ludo@gnu.org |
---|---|
State | Accepted |
Headers | show |
Series | Home: Clarify and better test symlink-manager.scm | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
Ludovic Courtès schreef op zo 27-02-2022 om 14:53 [+0100]: > * tests/guix-home.sh: Invoke "guix home reconfigure" a second time with > a modify config file and check the result. Something I don't understand, is why these tests are bash scripts in the first place. Wouldn't Scheme code suffice and be easier to reason about? For example, Scheme code would avoid repeating the complicated code for starting a daemon and making sure it exits in every .sh test. Greetings Maxime.
Maxime Devos <maximedevos@telenet.be> skribis: > Ludovic Courtès schreef op zo 27-02-2022 om 14:53 [+0100]: >> * tests/guix-home.sh: Invoke "guix home reconfigure" a second time with >> a modify config file and check the result. > > Something I don't understand, is why these tests are bash scripts in > the first place. > > Wouldn't Scheme code suffice and be easier to reason about? For > example, Scheme code would avoid repeating the complicated code for > starting a daemon and making sure it exits in every .sh test. It’s useful to have integration tests that exercise the commands; unit tests would also be welcome, but that’s what we have so far.
Ludovic Courtès schreef op za 05-03-2022 om 23:20 [+0100]: > It’s useful to have integration tests that exercise the commands; unit > tests would also be welcome, but that’s what we have so far. Integreation tests don't have to be in bash. We can have integration tests in Scheme, by running the 'guix-FOO' procedures from (guix scripts ...), like tests/substitute.scm and tests/publish.scm do. Greetings, Maxime.
p.s., I'm getting ‘Undelivered Mail Returned to Sender’: This is the mail system at host taslin.fdn.fr. I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below. For further assistance, please send mail to postmaster. If you do so, please include this problem report. You can delete your own text from the attached returned message. The mail system <lcourtes@fdn.fr> (expanded from <ludovic.courtes@fdn.fr>): host taslin.fdn.fr[private/dovecot-lmtp] said: 552 5.2.2 <lcourtes@fdn.fr> Quota exceeded, please contact vlp. (in reply to end of DATA command)
Hi Maxime, Maxime Devos <maximedevos@telenet.be> skribis: > Ludovic Courtès schreef op za 05-03-2022 om 23:20 [+0100]: >> It’s useful to have integration tests that exercise the commands; unit >> tests would also be welcome, but that’s what we have so far. > > Integreation tests don't have to be in bash. We can have integration > tests in Scheme, by running the 'guix-FOO' procedures from (guix > scripts ...), like tests/substitute.scm and tests/publish.scm do. Yes, you’re right, but this patch series is not about rewriting the integration tests. :-) The way I see it, we can choose and combine different strategies: Bash tests (the good thing is that they’re as close as can be to what users run), Scheme integration tests like you write when more fine-grain control is needed, and of course unit tests. Ludo’.
Maxime Devos <maximedevos@telenet.be> skribis:
> p.s., I'm getting ‘Undelivered Mail Returned to Sender’:
I think that’s solved, but my mail setup is still in flux… Don’t
hesitate to ping me on IRC or something if you think I might have missed
a message of yours.
Ludo’.
diff --git a/tests/guix-home.sh b/tests/guix-home.sh index 3b397649cc..f054d15172 100644 --- a/tests/guix-home.sh +++ b/tests/guix-home.sh @@ -108,6 +108,7 @@ EOF # Make sure preexisting files were backed up. grep "overridden" "$HOME"/*guix-home*backup/.bashrc grep "overridden" "$HOME"/*guix-home*backup/.config/test.conf + rm -r "$HOME"/*guix-home*backup # # Test 'guix home describe'. @@ -131,6 +132,28 @@ EOF } test "$(canonical_file_name)" == "$(readlink "${HOME}/.guix-home")" + # + # Configure a new generation. + # + + # Change the bashrc snippet content and comment out one service. + sed -i "home.scm" -e's/the content of/the NEW content of/g' + sed -i "home.scm" -e"s/(simple-service 'test-config/#;(simple-service 'test-config/g" + + guix home reconfigure "${test_directory}/home.scm" + test "$(tail -n 2 "${HOME}/.bashrc")" == "\ +# dot-bashrc test file for guix home +# the NEW content of bashrc-test-config.sh" + + # This file must have been removed and not backed up. + ! test -e "$HOME/.config/test.conf" + ! test -e "$HOME"/*guix-home*backup/.config/test.conf + + test "$(cat "$(configuration_file)")" == "$(cat home.scm)" + test "$(canonical_file_name)" == "$(readlink "${HOME}/.guix-home")" + + test $(guix home list-generations | grep "^Generation" | wc -l) -eq 2 + # # Test 'guix home search'. #