mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
test: also tests enumerating subsystems
This commit is contained in:
parent
b6b35f0e0b
commit
af18705f8e
@ -8,15 +8,7 @@
|
||||
#include "tests.h"
|
||||
#include "util.h"
|
||||
|
||||
static void test_sd_device_basic(void) {
|
||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
||||
sd_device *d;
|
||||
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
assert_se(sd_device_enumerator_new(&e) >= 0);
|
||||
assert_se(sd_device_enumerator_allow_uninitialized(e) >= 0);
|
||||
FOREACH_DEVICE(e, d) {
|
||||
static void test_sd_device_one(sd_device *d) {
|
||||
const char *syspath, *subsystem, *val;
|
||||
dev_t devnum;
|
||||
usec_t usec;
|
||||
@ -62,8 +54,31 @@ static void test_sd_device_basic(void) {
|
||||
r = sd_device_get_property_value(d, "ID_NET_DRIVER", &val);
|
||||
assert_se(r >= 0 || r == -ENOENT);
|
||||
|
||||
log_debug("subsystem:%s syspath:%s initialized:%s", strna(subsystem), syspath, yes_no(i));
|
||||
log_info("syspath:%s subsystem:%s initialized:%s", syspath, strna(subsystem), yes_no(i));
|
||||
}
|
||||
|
||||
static void test_sd_device_enumerator_devices(void) {
|
||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
||||
sd_device *d;
|
||||
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
assert_se(sd_device_enumerator_new(&e) >= 0);
|
||||
assert_se(sd_device_enumerator_allow_uninitialized(e) >= 0);
|
||||
FOREACH_DEVICE(e, d)
|
||||
test_sd_device_one(d);
|
||||
}
|
||||
|
||||
static void test_sd_device_enumerator_subsystems(void) {
|
||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
||||
sd_device *d;
|
||||
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
assert_se(sd_device_enumerator_new(&e) >= 0);
|
||||
assert_se(sd_device_enumerator_allow_uninitialized(e) >= 0);
|
||||
FOREACH_SUBSYSTEM(e, d)
|
||||
test_sd_device_one(d);
|
||||
}
|
||||
|
||||
static void test_sd_device_enumerator_filter_subsystem_one(const char *subsystem, Hashmap *h) {
|
||||
@ -133,7 +148,8 @@ static void test_sd_device_enumerator_filter_subsystem(void) {
|
||||
int main(int argc, char **argv) {
|
||||
test_setup_logging(LOG_INFO);
|
||||
|
||||
test_sd_device_basic();
|
||||
test_sd_device_enumerator_devices();
|
||||
test_sd_device_enumerator_subsystems();
|
||||
test_sd_device_enumerator_filter_subsystem();
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user