1 Star 0 Fork 49

yuguorui96/systemd_os

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0526-test-udev-test.pl-create-rules-only-once.patch 2.05 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2021-06-16 16:46 . update to systemd-239-45.el8.src.rpm
From 9aa12f2f564c208c4c1eaef613d18d1c0b481a16 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 23 Apr 2018 21:58:12 +0200
Subject: [PATCH] test/udev-test.pl: create rules only once
It's not necessary to write the rules for every udev run, as we
now may have many (rather than just 2) per test.
(cherry picked from commit af7ee3eae689f9c31b49ea13758ad9c901918ce3)
Related: #1642728
---
test/udev-test.pl | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/test/udev-test.pl b/test/udev-test.pl
index bd5401da75..8b5a97ad61 100755
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -2069,14 +2069,18 @@ EOF
},
);
-sub udev {
- my ($action, $devpath, $rules) = @_;
+sub create_rules {
+ my ($rules) = @_;
# create temporary rules
system("mkdir", "-p", "$udev_rules_dir");
open CONF, ">$udev_rules" || die "unable to create rules file: $udev_rules";
print CONF $$rules;
close CONF;
+}
+
+sub udev {
+ my ($action, $devpath) = @_;
if ($valgrind > 0) {
return system("$udev_bin_valgrind $action $devpath");
@@ -2259,9 +2263,10 @@ sub run_test {
my @devices = @{$rules->{devices}};
print "TEST $number: $rules->{desc}\n";
+ create_rules(\$rules->{rules});
foreach my $dev (@devices) {
print "device \'$dev->{devpath}\' expecting node/link \'$dev->{exp_name}\'\n";
- $rc = udev("add", $dev->{devpath}, \$rules->{rules});
+ $rc = udev("add", $dev->{devpath});
if ($rc != 0) {
print "$udev_bin add failed with code $rc\n";
$error++;
@@ -2278,7 +2283,7 @@ sub run_test {
}
foreach my $dev (@devices) {
- $rc = udev("remove", $dev->{devpath}, \$rules->{rules});
+ $rc = udev("remove", $dev->{devpath});
if ($rc != 0) {
print "$udev_bin remove failed with code $rc\n";
$error++;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yuguorui96/systemd_os.git
git@gitee.com:yuguorui96/systemd_os.git
yuguorui96
systemd_os
systemd_os
a8

搜索帮助

0d507c66 1850385 C8b1a773 1850385