tools: selftests: riscv: Fix compile warnings in vector tests
authorChristoph Müllner <christoph.muellner@vrull.eu>
Thu, 23 Nov 2023 18:58:20 +0000 (19:58 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 11 Jan 2024 16:02:50 +0000 (08:02 -0800)
GCC prints a couple of format string warnings when compiling
the vector tests. Let's follow the recommendation in
Documentation/printk-formats.txt to fix these warnings.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Link: https://lore.kernel.org/r/20231123185821.2272504-5-christoph.muellner@vrull.eu
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
tools/testing/selftests/riscv/vector/v_initval_nolibc.c
tools/testing/selftests/riscv/vector/vstate_prctl.c

index 66764edb0d5268e8e2aabcb2c47aa3bfdc84033e..1dd94197da30cc5d17c3aa731e6a50b48d3569f4 100644 (file)
@@ -27,7 +27,7 @@ int main(void)
 
        datap = malloc(MAX_VSIZE);
        if (!datap) {
-               ksft_test_result_fail("fail to allocate memory for size = %lu\n", MAX_VSIZE);
+               ksft_test_result_fail("fail to allocate memory for size = %d\n", MAX_VSIZE);
                exit(-1);
        }
 
index b348b475be570cdd14d9c7de13c35ece1dc3901c..8ad94e08ff4d079409efd6b84c8f39c9ab2b3b87 100644 (file)
@@ -68,7 +68,7 @@ int test_and_compare_child(long provided, long expected, int inherit)
        }
        rc = launch_test(inherit);
        if (rc != expected) {
-               ksft_test_result_fail("Test failed, check %d != %d\n", rc,
+               ksft_test_result_fail("Test failed, check %d != %ld\n", rc,
                                      expected);
                return -2;
        }
@@ -87,7 +87,7 @@ int main(void)
        pair.key = RISCV_HWPROBE_KEY_IMA_EXT_0;
        rc = riscv_hwprobe(&pair, 1, 0, NULL, 0);
        if (rc < 0) {
-               ksft_test_result_fail("hwprobe() failed with %d\n", rc);
+               ksft_test_result_fail("hwprobe() failed with %ld\n", rc);
                return -1;
        }