ALT Linux Team development discussions
 help / color / mirror / Atom feed
* [devel] Q: энтропия на сборочнице [bolt-0.9.1-alt1: Sisyphus/i586 test rebuild failed]
@ 2021-03-01 17:10 Konstantin Lepikhov
  2021-03-01 17:40 ` Alexey V. Vissarionov
  2021-03-01 17:56 ` Dmitry V. Levin
  0 siblings, 2 replies; 4+ messages in thread
From: Konstantin Lepikhov @ 2021-03-01 17:10 UTC (permalink / raw)
  To: ALT Linux Devel Mailing List

Привет!

Давно мучает меня эта "ошибка" пересборки

Код теста:

static void
test_strv_permute (TestRng *tt, gconstpointer user_data)
{
  g_auto(GStrv) tst = NULL;
  const char *ref[] = {"a", "b", "c", "d", NULL};
  char *empty[] = {NULL};
  guint N;
  guint k = 0;

  bolt_strv_permute (NULL);
  bolt_strv_permute (empty);

  g_assert_cmpuint (bolt_strv_length (empty), ==, 0U);

  tst = g_strdupv ((char **) ref);

  /* there are 4! = 24 possible permutations, do it
   * at least N = 4! and pick a rather large threshold
   * instead of a larger N */
  N = (4 * 3 * 2 * 1);

  for (guint i = 0; i < N; i++)
    {
      bolt_strv_permute (tst);
      if (bolt_strv_equal ((char **) ref, (char **) tst))
        k++;
    }

  g_debug ("permutation-test: %u of %u were equal", k, N);
  g_assert_cmpuint (k, <, 5);
}

...

У меня есть смутные подозрения, что в какой-то момент в сборочнице
кончается энтропия и начинается фигня

----- Forwarded message from ALT beekeeper <hiver@altlinux.org> -----

Date: Mon,  1 Mar 2021 15:48:15 +0000 (UTC)
From: ALT beekeeper <hiver@altlinux.org>
To: lakostis@altlinux.org
CC: hiver@altlinux.org
Subject: bolt-0.9.1-alt1: Sisyphus/i586 test rebuild failed

Package: bolt-0.9.1-alt1
Status: Sisyphus/i586 test rebuild failed
Cannot build this package.
Please investigate.
Excerpt from build log:

....

Bail out! ERROR:../tests/test-common.c:2141:test_strv_permute: assertion failed (k < 5): (5 < 5)
stderr:
**
ERROR:../tests/test-common.c:2141:test_strv_permute: assertion failed (k < 5): (5 < 5)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

13/17 test-exported OK               0.21s
14/17 test-udev     OK               0.07s
15/17 test-power    OK               0.11s
16/17 test-sysfs    OK               0.12s
17/17 test-reaper   OK               0.52s

Summary of Failures:

12/17 test-common   FAIL             0.29s   killed by signal 6 SIGABRT

Ok:                 16  
Expected Fail:      0   
Fail:               1   
Unexpected Pass:    0   
Skipped:            0   
Timeout:            0   

Full log written to /usr/src/RPM/BUILD/bolt-0.9.1/i586-alt-linux/meson-logs/testlog.txt
FAILED: meson-test 
/usr/bin/meson test --no-rebuild --print-errorlogs
ninja: build stopped: subcommand failed.
error: Bad exit status from /usr/src/tmp/rpm-tmp.7416 (%check)

RPM build errors:
    Bad exit status from /usr/src/tmp/rpm-tmp.7416 (%check)
Command exited with non-zero status 1
40.56user 3.99system 0:19.74elapsed 225%CPU (0avgtext+0avgdata 62568maxresident)k
0inputs+0outputs (0major+1547522minor)pagefaults 0swaps
hsh-rebuild: rebuild of `bolt-0.9.1-alt1.src.rpm' failed.
Command exited with non-zero status 1

-- 
Sincerely yours,
ALT beekeeper

----- End forwarded message -----

-- 
WBR et al.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [devel] Q: энтропия на сборочнице [bolt-0.9.1-alt1: Sisyphus/i586 test rebuild failed]
  2021-03-01 17:10 [devel] Q: энтропия на сборочнице [bolt-0.9.1-alt1: Sisyphus/i586 test rebuild failed] Konstantin Lepikhov
@ 2021-03-01 17:40 ` Alexey V. Vissarionov
  2021-03-01 17:56 ` Dmitry V. Levin
  1 sibling, 0 replies; 4+ messages in thread
From: Alexey V. Vissarionov @ 2021-03-01 17:40 UTC (permalink / raw)
  To: ALT Linux Team development discussions

On 2021-03-01 18:10:32 +0100, Konstantin Lepikhov wrote:

 > Давно мучает меня эта "ошибка" пересборки
 > Код теста:
 > [...]
 > У меня есть смутные подозрения, что в какой-то момент в
 > сборочнице кончается энтропия и начинается фигня
 > [...]
 > Bail out! ERROR:../tests/test-common.c:2141:test_strv_permute:
 > assertion failed (k < 5): (5 < 5)
 > stderr: ** ERROR:../tests/test-common.c:2141:test_strv_permute:
 > assertion failed (k < 5): (5 < 5)

Между buildtime и runtime тестами есть существенная разница, и
очень печально, что в данном случае разработчики ее игнорируют.

Если тест можно вынести в %package, чтобы проводить проверки
в среде выполнения (а он, насколько я понимаю, нужен прежде
всего именно там) - было бы хорошо именно так и сделать. Если
же это нетривиально (неоправданно трудоемко) - думаю, вполне
допустимо просто отключить этот тест: мы уже знаем, почему он
не проходит.


-- 
Alexey V. Vissarionov
gremlin ПРИ altlinux ТЧК org; +vii-cmiii-ccxxix-lxxix-xlii
GPG: 0D92F19E1C0DC36E27F61A29CD17E2B43D879005 @ hkp://keys.gnupg.net


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [devel] Q: энтропия на сборочнице [bolt-0.9.1-alt1: Sisyphus/i586 test rebuild failed]
  2021-03-01 17:10 [devel] Q: энтропия на сборочнице [bolt-0.9.1-alt1: Sisyphus/i586 test rebuild failed] Konstantin Lepikhov
  2021-03-01 17:40 ` Alexey V. Vissarionov
@ 2021-03-01 17:56 ` Dmitry V. Levin
  2021-03-02  9:36   ` Konstantin Lepikhov
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitry V. Levin @ 2021-03-01 17:56 UTC (permalink / raw)
  To: devel

On Mon, Mar 01, 2021 at 06:10:32PM +0100, Konstantin Lepikhov wrote:
> Привет!
> 
> Давно мучает меня эта "ошибка" пересборки
> 
> Код теста:
> 
> static void
> test_strv_permute (TestRng *tt, gconstpointer user_data)
> {
>   g_auto(GStrv) tst = NULL;
>   const char *ref[] = {"a", "b", "c", "d", NULL};
>   char *empty[] = {NULL};
>   guint N;
>   guint k = 0;
> 
>   bolt_strv_permute (NULL);
>   bolt_strv_permute (empty);
> 
>   g_assert_cmpuint (bolt_strv_length (empty), ==, 0U);
> 
>   tst = g_strdupv ((char **) ref);
> 
>   /* there are 4! = 24 possible permutations, do it
>    * at least N = 4! and pick a rather large threshold
>    * instead of a larger N */
>   N = (4 * 3 * 2 * 1);
> 
>   for (guint i = 0; i < N; i++)
>     {
>       bolt_strv_permute (tst);
>       if (bolt_strv_equal ((char **) ref, (char **) tst))
>         k++;
>     }
> 
>   g_debug ("permutation-test: %u of %u were equal", k, N);
>   g_assert_cmpuint (k, <, 5);
> }
> 
> ...
> 
> У меня есть смутные подозрения, что в какой-то момент в сборочнице
> кончается энтропия и начинается фигня

Это что, неустранимо вероятностный тест, который, если его запускать
достаточно много раз, обязательно упадёт?  А где он добывает себе
рандомизацию?


-- 
ldv


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [devel] Q: энтропия на сборочнице  [bolt-0.9.1-alt1: Sisyphus/i586 test rebuild failed]
  2021-03-01 17:56 ` Dmitry V. Levin
@ 2021-03-02  9:36   ` Konstantin Lepikhov
  0 siblings, 0 replies; 4+ messages in thread
From: Konstantin Lepikhov @ 2021-03-02  9:36 UTC (permalink / raw)
  To: devel

Hi Dmitry!

On 03/01/2021, at 08:56:20 PM you wrote:

<skip>
> > У меня есть смутные подозрения, что в какой-то момент в сборочнице
> > кончается энтропия и начинается фигня
> 
> Это что, неустранимо вероятностный тест, который, если его запускать
> достаточно много раз, обязательно упадёт?  А где он добывает себе
> рандомизацию?
Из того, что я вижу по логам пересборки, да, падения происходят
периодически и почему-то только на i586 и x86_64

По рандомизации:


/* general function */
typedef enum {
  BOLT_RNG_ERROR = -1,
  BOLT_RNG_URANDOM = 1,
  BOLT_RNG_PRNG = 2,
  BOLT_RNG_GETRANDOM = 3,
} BoltRng;

...

#if HAVE_FN_GETRANDOM
#include <sys/random.h>
# else
# define GRND_NONBLOCK 0
#endif

int
bolt_get_random_data (void *buf, gsize n)
{
  gboolean ok;

  ok = bolt_random_getrandom (buf, n, GRND_NONBLOCK, NULL);
  if (ok)
    return BOLT_RNG_GETRANDOM;

  ok = bolt_random_urandom (buf, n);

  if (ok)
    return BOLT_RNG_URANDOM;

  bolt_random_prng (buf, n);
  return BOLT_RNG_PRNG;
}

/* specific implementations */
gboolean
bolt_random_getrandom (void    *buf,
                       gsize    n,
                       unsigned flags,
                       GError **error)
{
  int r = -1;

  g_return_val_if_fail (buf != NULL, FALSE);
  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);

#if HAVE_FN_GETRANDOM
  r = getrandom (buf, n, flags);
#else
  errno = ENOSYS;
#endif

  if (r < 0)
    {
      g_set_error (error, G_IO_ERROR,
                   g_io_error_from_errno (errno),
                   "failed to get random data: %s",
                   g_strerror (errno));
      return FALSE;
    }

  return TRUE;
}

gboolean
bolt_random_urandom (void *buf, gsize n)
{
  gboolean ok;
  int rndfd;
  gsize len;

  g_return_val_if_fail (buf != NULL, FALSE);

  rndfd = bolt_open ("/dev/urandom", O_RDONLY | O_CLOEXEC | O_NOCTTY, 0, NULL);

  if (rndfd < 0)
    return FALSE;

  ok = bolt_read_all (rndfd, buf, n, &len, NULL);

  (void) close (rndfd);

  /* NB: according to the man page random(4), "when calling
     read(2) for the device /dev/urandom, reads of up to 256
     bytes will return as many bytes as are requested and will
     not be interrupted by a signal handler".
   */
  return ok && len == n;
}

void
bolt_random_prng (void *buf, gsize n)
{
  char *ptr = buf;
  const gsize l = n % sizeof (guint32);
  const gsize k = n - l;

  if (buf == NULL || n == 0)
    return;

  for (gsize i = 0; i < k; i += sizeof (guint32))
    {
      guint32 r = g_random_int ();
      memcpy (ptr + i, &r, sizeof (guint32));
    }

  if (l > 0)
    {
      guint32 r = g_random_int ();
      memcpy (ptr + k, &r, l);
    }
}

-- 
WBR et al.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-02  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 17:10 [devel] Q: энтропия на сборочнице [bolt-0.9.1-alt1: Sisyphus/i586 test rebuild failed] Konstantin Lepikhov
2021-03-01 17:40 ` Alexey V. Vissarionov
2021-03-01 17:56 ` Dmitry V. Levin
2021-03-02  9:36   ` Konstantin Lepikhov

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git