You are not logged in.

#1 2024-11-21 14:46:01

roxdio
Member
Registered: 2024-11-20
Posts: 7

Personal PKGBUILD for Emacs giving error when running tests

I am trying to write my own PKGBUILD file for Emacs (with my own custom configuration), but I keep encountering a problem when `makepkg` runs the `check ()` function, which I have set as:

    check (){
            cd ${pkgname}-${pkgver}
            make -k check
    }

This is run after `build`, and results in one of the tests failing:

    FAILED  1/7  emacs-tests/bwrap/allows-stdout (1.676436 sec) at src/emacs-tests.el:175
    passed  2/7  emacs-tests/seccomp/absent-file (0.215495 sec)
    passed  3/7  emacs-tests/seccomp/allows-stdout (0.365716 sec)
    passed  4/7  emacs-tests/seccomp/empty-file (0.213629 sec)
    passed  5/7  emacs-tests/seccomp/file-too-large (0.435880 sec)
    passed  6/7  emacs-tests/seccomp/forbids-subprocess (1.323565 sec)
    passed  7/7  emacs-tests/seccomp/invalid-file-size (0.306250 sec)

    Ran 7 tests, 6 results as expected, 1 unexpected

    1 unexpected results:
    FAILED  emacs-tests/bwrap/allows-stdout

But if I build Emacs with my config flags by just running `./configure $confflags` (assume `$confflags` has my full list of options), running `make` and then doing `make -k check`, there is no problem with the test -- it passes:

    passed  1/7  emacs-tests/bwrap/allows-stdout (0.290183 sec)
    passed  2/7  emacs-tests/seccomp/absent-file (0.042133 sec)
    passed  3/7  emacs-tests/seccomp/allows-stdout (0.070669 sec)
    passed  4/7  emacs-tests/seccomp/empty-file (0.035593 sec)
    passed  5/7  emacs-tests/seccomp/file-too-large (0.053210 sec)
    passed  6/7  emacs-tests/seccomp/forbids-subprocess (0.362152 sec)
    passed  7/7  emacs-tests/seccomp/invalid-file-size (0.036310 sec)

    Ran 7 tests, 7 results as expected, 0 unexpected

This is my first time writing a proper `PKGBUILD` file so I'm probably doing something incorrect.
But is there some kind of permissions issue -- i.e. does `makepkg` need me to run `sudo make -k check` -- that has to be addressed before I can run the check?


FYI: The test in question is not particular relevant to me, but I'd like to understand why it is not passing. I understand that it involves using the audit framework but this is not something that I've enabled as a kernel parameter, and enabling/disabling `auditd.service` does not fix this.

Last edited by roxdio (2024-11-21 15:10:42)

Offline

#2 2024-11-21 16:15:39

seth
Member
Registered: 2012-09-03
Posts: 59,120

Re: Personal PKGBUILD for Emacs giving error when running tests

Same as
https://forum.manjaro.org/t/building-em … ck/170360/
https://www.reddit.com/r/emacs/comments … or_failed/ ?

I don't think this has anything to o w/ the audit system - it's more likely that bwrap fails in the fakeroot environment.

Offline

#3 2024-11-21 17:56:34

roxdio
Member
Registered: 2024-11-20
Posts: 7

Re: Personal PKGBUILD for Emacs giving error when running tests

Thanks -- is there something I can do to check or test this? I didn't see the message about entering fakeroot when running `makepkg` (which I sometimes see when AUR packages are built).

Offline

#4 2024-11-21 20:36:53

seth
Member
Registered: 2012-09-03
Posts: 59,120

Re: Personal PKGBUILD for Emacs giving error when running tests

"fakeroot make -k checkI",  guess - but from the manpage check() isn't actually run under fakeroot…

Stupid question, what if you run make check in the build() function?

Offline

#5 2024-11-22 12:24:59

roxdio
Member
Registered: 2024-11-20
Posts: 7

Re: Personal PKGBUILD for Emacs giving error when running tests

Huh ... running

fakeroot make -k check

in the existing `src/emacs-29.4` directory created by `makepkg` doesn't produce the `allow-stdout`/`bwrap` error above -- that test passes -- but now there is a different error from `bytecomp-tests.el`:

Ran 84 tests, 83 results as expected, 1 unexpected

1 unexpected results:
   FAILED  bytecomp-tests--dest-mountpoint

Stupid question, what if you run make check in the build() function?

Following your question, I added `make -k check` to the `build()` function and removed `check()` from the `PKGBUILD`. This still produces the same `bwrap` related test error from before.

Last edited by roxdio (2024-11-22 12:32:31)

Offline

#6 2024-11-22 13:05:53

seth
Member
Registered: 2012-09-03
Posts: 59,120

Re: Personal PKGBUILD for Emacs giving error when running tests

In case the seccomp test for stdout gets skipped (absent seccomp) it might be really that.

make -k check  >&-

then probably fails? Do you still get output (on stderr)?

Offline

#7 2024-11-22 13:47:52

roxdio
Member
Registered: 2024-11-20
Posts: 7

Re: Personal PKGBUILD for Emacs giving error when running tests

Sorry, not sure I understand. Are you saying that I should have

make -k check  >&-

in the `check()` function?

Also, I have been running all these commands with a `

|& tee foo.log

so that I can keep track of all the output after making changes, including from `stderr`.

Offline

#8 2024-11-22 22:50:20

seth
Member
Registered: 2012-09-03
Posts: 59,120

Re: Personal PKGBUILD for Emacs giving error when running tests

The idea is that "make -k check  >&-" will fail outside the pkgbuild because you're closing the stdin.

Offline

#9 2024-11-23 21:22:58

roxdio
Member
Registered: 2024-11-20
Posts: 7

Re: Personal PKGBUILD for Emacs giving error when running tests

I still wasn't sure what you meant for me to try, so here is what happens when I run `make -k check >&-` by hand:

  INFO     Scraping files for loaddefs...
  INFO     Scraping files for loaddefs...done
  INFO     Scraping files for loaddefs...
  INFO     Scraping files for loaddefs...done

SUMMARY OF TEST RESULTS
-----------------------
Files examined: 471
Ran 7038 tests, 6877 results as expected, 0 unexpected, 161 skipped

This is the same result as before -- no errors in the tests -- but now the output has been suppressed.


I also run `makepkg` with the `check` function defined as

check (){
	cd ${pkgname}-${pkgver}
	make -k check >&-
}

There is now less output when the `check` part of PKGBUILD is run, but I still get the original error, plus a new one that might be related to the suppression of `stdin`:

make[3]: *** [Makefile:293: src/emacs-module-resources/mod-test.so] Error 1
make[3]: Target 'src/emacs-module-tests.log' not remade because of errors.
cat: standard output: Bad file descriptor
make[3]: *** [Makefile:181: src/emacs-tests.log] Error 1
make[2]: [Makefile:340: check-doit] Error 2 (ignored)

SUMMARY OF TEST RESULTS
-----------------------
Files examined: 471
Ran 7167 tests, 7008 results as expected, 1 unexpected, 158 skipped
1 files did not contain any tests:
  src/emacs-module-tests.log
1 files contained unexpected results:
  src/emacs-tests.log
make[2]: *** [Makefile:341: check-doit] Error 2
make[1]: *** [Makefile:310: check] Error 2
make: *** [Makefile:1105: check] Error 2
==> ERROR: A failure occurred in check().
    Aborting...

Offline

#10 2024-11-25 08:43:07

seth
Member
Registered: 2012-09-03
Posts: 59,120

Re: Personal PKGBUILD for Emacs giving error when running tests

I still wasn't sure what you meant for me to try

I run `make -k check >&-`

This - and apparently it's not a closed stdout that's at fault (but breaks a different test)

You'll have to debug emacs-tests.el, ie. make it print more about what it does and what fails how.
Or do you get an error log for the original problem, too?

Offline

#11 2024-11-26 08:57:31

roxdio
Member
Registered: 2024-11-20
Posts: 7

Re: Personal PKGBUILD for Emacs giving error when running tests

The output of every test goes into a log file, here is the -- lightly edited -- entry of `emacs-tests.log`.

Running 7 tests (2024-11-25 01:13:38, selector `(not (or (tag :expensive-test) (tag :unstable)))')
Test emacs-tests/bwrap/allows-stdout backtrace:
  ert-fail(((should (eql status 0)) :form (eql 159 0) :value nil))
  #f(compiled-function () #<bytecode -0x197e7b229072b302>)()
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name emacs-tests/bwrap/allows-stdout :docu
  ert-run-or-rerun-test(#s(ert--stats :selector (not (or (tag :expensi
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable))) #f(co
  ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable)))
  ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
  command-line-1(("-L" ":." "-l" "ert" "-l" "src/emacs-tests" "--eval"
  command-line()
  normal-top-level()
Test emacs-tests/bwrap/allows-stdout condition:
    Info: Process output:
          
          Potentially relevant Seccomp audit events:
          Error opening /var/log/audit/audit.log (No such file or directory)
          
          Potentially useful coredump information:
                     PID: 2835097 (emacs)
                  Signal: 31 (SYS)
            Command Line: /home/emacs-29.4/src/emacs-29.4/src/emacs --quick --batch $'--eval=(message "Hi")'
              Executable: /home/emacs-29.4/src/emacs-29.4/src/emacs
           Control Group: /user.slice/user-1000.slice/session-2.scope
                    Unit: session-2.scope
                   Slice: user-1000.slice
                 Session: 2
                 Storage: /var/lib/systemd/coredump/core.emacs.1000.bc36a80a66444d028258c75a5c61b52b.2835097.1732391018000000.zst (present)
            Size on Disk: 2.5M
                 Message: Process 2835097 (emacs) of user 1000 dumped core.
                          
                          Stack trace of thread 2835097:
                          #0  0x00007f1102738760 pthread_getaffinity_np (libc.so.6 + 0x95760)
                          #1  0x00007f11020308c7 gomp_init_num_threads (libgomp.so.1 + 0x238c7)
                          #2  0x00007f11020181bc initialize_env (libgomp.so.1 + 0xb1bc)
                          #3  0x00007f110e3655b7 n/a (ld-linux-x86-64.so.2 + 0x45b7)
                          #4  0x00007f110e3656ad n/a (ld-linux-x86-64.so.2 + 0x46ad)
                          #5  0x00007f110e37de20 n/a (ld-linux-x86-64.so.2 + 0x1ce20)
                          ELF object binary architecture: AMD x86-64
          
    (ert-test-failed
     ((should
       (eql status 0))
      :form
      (eql 159 0)
      :value nil))
   FAILED  1/7  emacs-tests/bwrap/allows-stdout (1.309238 sec) at src/emacs-tests.el:175
   passed  2/7  emacs-tests/seccomp/absent-file (0.252029 sec)
   passed  3/7  emacs-tests/seccomp/allows-stdout (0.412172 sec)
   passed  4/7  emacs-tests/seccomp/empty-file (0.400958 sec)
   passed  5/7  emacs-tests/seccomp/file-too-large (0.373853 sec)
   passed  6/7  emacs-tests/seccomp/forbids-subprocess (1.859388 sec)
   passed  7/7  emacs-tests/seccomp/invalid-file-size (0.318251 sec)

Ran 7 tests, 6 results as expected, 1 unexpected 

1 unexpected results:
   FAILED  emacs-tests/bwrap/allows-stdout

At this point, it might be worth just raising this as a bug on the Emacs mailing list.

Last edited by roxdio (2024-11-26 09:01:24)

Offline

#12 2024-11-26 20:35:18

seth
Member
Registered: 2012-09-03
Posts: 59,120

Re: Personal PKGBUILD for Emacs giving error when running tests

Does

export MAKEFLAGS="--jobs=$(nproc)"

or

export MAKEFLAGS="--jobs=2"

  help with that?

Offline

#13 2024-11-27 08:51:26

roxdio
Member
Registered: 2024-11-20
Posts: 7

Re: Personal PKGBUILD for Emacs giving error when running tests

Thanks, but no change in the error unfortunately.

Offline

Board footer

Powered by FluxBB