]> git.ipfire.org Git - pakfire.git/commitdiff
tests: command: Rename pid to print-pid
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 3 Aug 2022 15:59:54 +0000 (15:59 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 3 Aug 2022 15:59:54 +0000 (15:59 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/python/execute.py
tests/stub/command.c

index 29b373802920bc05b55b2d131d9f7d08a6e7855f..9870369168c5ca459084b135875acfe388bf388a 100755 (executable)
@@ -104,7 +104,7 @@ class Test(unittest.TestCase):
                        # The PID must be 1
                        self.assertEqual(message, "1")
 
-               self.pakfire.execute(["/command", "pid"], logging_callback=checkpid)
+               self.pakfire.execute(["/command", "print-pid"], logging_callback=checkpid)
 
        def test_nice(self):
                self.pakfire.execute(["/command", "print-nice"], nice=5)
index 53b0714b97e557dc1e3761e7094aedddb037d727..c37f734954246a93066af116fddbc50957851bce 100644 (file)
@@ -155,22 +155,22 @@ static int lines(int argc, char* argv[]) {
        return 0;
 }
 
-static int pid(int argc, char* argv[]) {
-       pid_t pid = getpid();
-       if (!pid)
-               return 1;
+static int print_nice(int argc, char* argv[]) {
+       int nice = getpriority(PRIO_PROCESS, 0);
 
-       // Print the PID
-       printf("%d\n", pid);
+       // Print the nice level
+       printf("%d\n", nice);
 
        return 0;
 }
 
-static int print_nice(int argc, char* argv[]) {
-       int nice = getpriority(PRIO_PROCESS, 0);
+static int print_pid(int argc, char* argv[]) {
+       pid_t pid = getpid();
+       if (!pid)
+               return 1;
 
-       // Print the nice level
-       printf("%d\n", nice);
+       // Print the PID
+       printf("%d\n", pid);
 
        return 0;
 }
@@ -208,14 +208,14 @@ int main(int argc, char* argv[]) {
        else if (strcmp(command, "lines") == 0)
                callback = lines;
 
-       // Print PID
-       else if (strcmp(command, "pid") == 0)
-               callback = pid;
-
        // Print nice level
        else if (strcmp(command, "print-nice") == 0)
                callback = print_nice;
 
+       // Print PID
+       else if (strcmp(command, "print-pid") == 0)
+               callback = print_pid;
+
        // Exit if no callback has been set
        if (!callback) {
                fprintf(stderr, "Unknown command: %s\n", command);