From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Adding a TOR system test - confusing results Date: Mon, 23 Jul 2018 11:01:17 +0200 Message-ID: <87y3e2tjfm.fsf@gnu.org> References: <87k1pmhkp9.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhWiY-0005Yj-QW for guix-devel@gnu.org; Mon, 23 Jul 2018 05:01:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhWiV-0000Ao-PJ for guix-devel@gnu.org; Mon, 23 Jul 2018 05:01:22 -0400 In-Reply-To: <87k1pmhkp9.fsf@gmail.com> (Chris Marusich's message of "Sun, 22 Jul 2018 17:14:42 -0700") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Chris Marusich Cc: guix-devel@gnu.org Hi Chris, Chris Marusich skribis: > To begin, let's apply the first patch ("Add system tests for the TOR > service."). Then run the test: > > $ make -j1 check-system TESTS=3Dtor > [...] > # of expected passes 1 > @ build-succeeded /gnu/store/zdh97qnh4b69yr23yp5js16hw9lvjhzm-tor-test.dr= v - > TOTAL: 1 > PASS: /gnu/store/c3f0y7jbqi1qw8s63p3jbp5mrwl1bxnc-tor-test > > > It passed! Great! Now, let's make sure it also detects failures > correctly: Let's break TOR by applying the second patch ("For testing > purposes, break the TOR service."). Then run it again: > > $ make -j1 check-system TESTS=3Dtor > [...] > This is the GNU system. Welcome. > komputilo login: exec of "/gnu/store/5jhlsv29n6kx76na1kkgfarznrl5kjjg-tor= -0.3.3.9DOES-NOT-EXIST" failed: No such file or directory > QEMU runs as PID 4 > connected to QEMU's monitor > read QEMU monitor prompt > connected to guest REPL > %%%% Starting test tor (Writing full log to "tor.log") > marionette is ready > # of expected passes 1 > @ build-succeeded /gnu/store/z8q9y8zivsipaq9fdj7yhhcvqgfq8ryl-tor-test.dr= v - The problem has to do with =E2=80=98make-forkexec-constructor/container=E2= =80=99: it creates a process (with =E2=80=98run-container=E2=80=99) that exec=E2=80=99= s the program, and then returns immediately. Thus we know that a process was created, but we don=E2=80=99t know that soon after that it exited because of a failed = =E2=80=98exec=E2=80=99 call. If you run it in a VM, you=E2=80=99ll notice that shepherd tries to respawn= it several times in a row and eventually disables the service. The test above is unreliable because during this fail/respawn cycle, the service keeps going up and down. The solution here would be to use a PID file for the Tor service. That would (1) allow us to properly detect failure to run Tor, and (2) provide better synchronization with Tor startup. HTH! Ludo=E2=80=99.