summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-06-12 19:51:11 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-06-12 21:15:53 -0400
commit18dade5aaee9f13efb95e6359723974d811c9b1e (patch)
treec4783def19d4325847131b0ccf4751847a5d503f /src/test
parent9a140c3564006216e4c3a20c8d657669c09544c4 (diff)
test-process-util: allow pid to be specified on the command line
This makes it easy to test the query code on "ssh localhost" and similar.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-process-util.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c
index 40bf8b3c10..8bb5f6e3a3 100644
--- a/src/test/test-process-util.c
+++ b/src/test/test-process-util.c
@@ -28,6 +28,7 @@
#include "architecture.h"
#include "log.h"
#include "macro.h"
+#include "parse-util.h"
#include "process-util.h"
#include "stdio-util.h"
#include "string-util.h"
@@ -150,8 +151,16 @@ int main(int argc, char *argv[]) {
log_parse_environment();
log_open();
- test_get_process_comm(1);
- test_get_process_comm(getpid());
+ if (argc > 1) {
+ pid_t pid = 0;
+
+ (void) parse_pid(argv[1], &pid);
+ test_get_process_comm(pid);
+ } else {
+ test_get_process_comm(1);
+ test_get_process_comm(getpid());
+ }
+
test_pid_is_unwaited();
test_pid_is_alive();
test_personality();