udevadm-test.c revision 07630cea1f3a845c09309f197ac7c4f11edd3b62
/*
* Copyright (C) 2003-2004 Greg Kroah-Hartman <greg@kroah.com>
* Copyright (C) 2004-2008 Kay Sievers <kay@vrfy.org>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <getopt.h>
#include <signal.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/signalfd.h>
#include <unistd.h>
#include "string-util.h"
#include "udev-util.h"
#include "udev.h"
static void help(void) {
printf("%s test OPTIONS <syspath>\n\n"
"Test an event run.\n"
" -h --help Show this help\n"
" --version Show package version\n"
" -a --action=ACTION Set action string\n"
" -N --resolve-names=early|late|never When to resolve names\n"
}
int resolve_names = 1;
char filename[UTIL_PATH_SIZE];
const char *action = "add";
struct udev_list_entry *entry;
int rc = 0, c;
{}
};
switch (c) {
case 'a':
break;
case 'N':
resolve_names = 1;
resolve_names = 0;
resolve_names = -1;
} else {
log_error("resolve-names must be early, late or never");
}
break;
case 'h':
help();
case '?':
default:
assert_not_reached("Unknown option");
}
rc = 2;
goto out;
}
printf("This program is for debugging only, it does not run any program\n"
"specified by a RUN key. It may show incorrect results, because\n"
"some values may be different, or not available at a simulation run.\n"
"\n");
rc = 3;
goto out;
}
/* add /sys if needed */
else
rc = 4;
goto out;
}
/* don't read info from the db */
sigfillset(&mask);
NULL,
rules);
char program[UTIL_PATH_SIZE];
}
out:
return rc;
}
const struct udevadm_cmd udevadm_test = {
.name = "test",
.help = "Test an event run",
.debug = true,
};