All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/4] lib: Add .modprobe
Date: Fri, 3 Nov 2023 15:58:13 +0100	[thread overview]
Message-ID: <20231103145813.GA1084358@pevik> (raw)
In-Reply-To: <ZUTluqkrUOBLHw7G@yuki>

Hi Cyril,

> Hi!
> > Yes, but see safe_cmd() in lib/tst_safe_macros.c. tst_cmd() is called with 
> > TST_CMD_PASS_RETVAL | TST_CMD_TCONF_ON_MISSING, thus this is covered.

> TCONF_ON_MISSING means to TCONF when the command is missing, i.e. if
> modprobe is not installed on the system. When module is missing modprobe
> will return 1 so I suppose we have to handle the return value from the
> TST_CMD() or do I missing something?

Ah yes, you're right:
modprobe: FATAL: Module foo not found in directory /lib/modules/6.5.0-1-amd64
uevent02.c:134: TBROK: modprobe failed (1)

But unfortunately we will have to parse error log, because exit code is still 1 [1]:

return err >= 0 ? EXIT_SUCCESS : EXIT_FAILURE;

And indeed, although this would be expected:

# modprobe foo; echo $?
modprobe: FATAL: Module foo not found in directory /lib/modules/6.5.0-1-amd64
1

This would deserve different exit code:

$ modprobe dccp; echo $?
modprobe: ERROR: could not insert 'dccp': Operation not permitted
1

> > > modprobe -r please, rmmod has been deprecated for ages.

> > Ah, here goes the reason. Should it be replaced also in tst_module_unload_()?

> Yes please.

+1

Kind regards,
Petr

[1] https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/tree/tools/modprobe.c#n1047

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2023-11-03 14:58 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-13  7:47 [LTP] [PATCH 0/4] Add .modprobe (loading modules in C API) Petr Vorel
2023-10-13  7:47 ` [LTP] [PATCH 1/4] tst_kernel: Add safe_check_driver() Petr Vorel
2023-10-13 12:24   ` Petr Vorel
2023-10-13  7:47 ` [LTP] [PATCH 2/4] lib: Add .modprobe Petr Vorel
2023-10-13 12:09   ` Li Wang
2023-10-13 12:22     ` Petr Vorel
2023-10-16  9:05     ` Li Wang
2023-10-27 12:01     ` Petr Vorel
2023-11-01 16:33       ` Cyril Hrubis
2023-11-03 15:22         ` Petr Vorel
2023-10-13 12:30   ` Petr Vorel
2023-10-13 13:27     ` Li Wang
2023-10-13 13:50       ` Petr Vorel
2023-10-16  8:28         ` Li Wang
2023-11-01 16:26   ` Cyril Hrubis
2023-11-01 16:35     ` Cyril Hrubis
2023-11-03 15:54       ` Petr Vorel
2023-11-03 16:31         ` Edward Liaw via ltp
2023-11-03 12:12     ` Petr Vorel
2023-11-03 12:21       ` Cyril Hrubis
2023-11-03 14:58         ` Petr Vorel [this message]
2023-10-13  7:47 ` [LTP] [PATCH 3/4] madvise11: Replace .needs_drivers with .modprobe Petr Vorel
2023-10-13  7:47 ` [LTP] [PATCH 4/4] can_bcm01: Move vcan to .modprobe Petr Vorel
2023-11-02  9:22   ` Richard Palethorpe
2023-11-03 15:08     ` Petr Vorel
2023-10-16  7:47 ` [LTP] [PATCH 0/4] Add .modprobe (loading modules in C API) Richard Palethorpe
2023-10-16  8:41   ` Richard Palethorpe
2023-10-16 15:12   ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231103145813.GA1084358@pevik \
    --to=pvorel@suse.cz \
    --cc=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.