File: git_tests_alignment.patch

package info (click to toggle)
pulseaudio 17.0%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 16,420 kB
  • sloc: ansic: 157,280; sh: 1,050; python: 789; cpp: 298; perl: 166; xml: 84; makefile: 75
file content (101 lines) | stat: -rw-r--r-- 4,047 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
From: Arun Raghavan <arun@asymptotic.io>
Date: Fri, 22 Mar 2024 09:31:48 -0400
Subject: tests: Don't run volume tests with impossible alignments

This worked so far somehow, but we were sending in some samples at
unrealistic alignments (given that pa_memblockq will be frame-aligned,
and we expect all operations to occur per-frame as well).

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/3803
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/812>
---
 src/tests/cpu-volume-test.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/src/tests/cpu-volume-test.c b/src/tests/cpu-volume-test.c
index c7d73be04..24811ead0 100644
--- a/src/tests/cpu-volume-test.c
+++ b/src/tests/cpu-volume-test.c
@@ -43,6 +43,7 @@ static void run_volume_test(
         int channels,
         bool correct,
         bool perf) {
+    fail_unless(align % channels == 0);
 
     PA_DECLARE_ALIGNED(8, int16_t, s[SAMPLES]) = { 0 };
     PA_DECLARE_ALIGNED(8, int16_t, s_ref[SAMPLES]) = { 0 };
@@ -56,8 +57,6 @@ static void run_volume_test(
     samples_ref = s_ref + (8 - align);
     samples_orig = s_orig + (8 - align);
     nsamples = SAMPLES - (8 - align);
-    if (nsamples % channels)
-        nsamples -= nsamples % channels;
     size = nsamples * sizeof(int16_t);
 
     pa_random(samples, size);
@@ -119,12 +118,12 @@ START_TEST (svolume_mmx_test) {
 
     pa_log_debug("Checking MMX svolume");
     for (i = 1; i <= 3; i++) {
-        for (j = 0; j < 7; j++)
-            run_volume_test(mmx_func, orig_func, j, i, true, false);
+        for (j = 0; j <= 7; j += i)
+            run_volume_test(mmx_func, orig_func, j, i, true, j == 0);
     }
     run_volume_test(mmx_func, orig_func, 7, 1, true, true);
-    run_volume_test(mmx_func, orig_func, 7, 2, true, true);
-    run_volume_test(mmx_func, orig_func, 7, 3, true, true);
+    run_volume_test(mmx_func, orig_func, 6, 2, true, true);
+    run_volume_test(mmx_func, orig_func, 6, 3, true, true);
 }
 END_TEST
 
@@ -146,12 +145,12 @@ START_TEST (svolume_sse_test) {
 
     pa_log_debug("Checking SSE2 svolume");
     for (i = 1; i <= 3; i++) {
-        for (j = 0; j < 7; j++)
-            run_volume_test(sse_func, orig_func, j, i, true, false);
+        for (j = 0; j < 7; j += i)
+            run_volume_test(sse_func, orig_func, j, i, true, j == 0);
     }
     run_volume_test(sse_func, orig_func, 7, 1, true, true);
-    run_volume_test(sse_func, orig_func, 7, 2, true, true);
-    run_volume_test(sse_func, orig_func, 7, 3, true, true);
+    run_volume_test(sse_func, orig_func, 6, 2, true, true);
+    run_volume_test(sse_func, orig_func, 6, 3, true, true);
 }
 END_TEST
 #endif /* defined (__i386__) || defined (__amd64__) */
@@ -175,12 +174,12 @@ START_TEST (svolume_arm_test) {
 
     pa_log_debug("Checking ARM svolume");
     for (i = 1; i <= 3; i++) {
-        for (j = 0; j < 7; j++)
-            run_volume_test(arm_func, orig_func, j, i, true, false);
+        for (j = 0; j < 7; j += i)
+            run_volume_test(arm_func, orig_func, j, i, true, j == 0);
     }
     run_volume_test(arm_func, orig_func, 7, 1, true, true);
-    run_volume_test(arm_func, orig_func, 7, 2, true, true);
-    run_volume_test(arm_func, orig_func, 7, 3, true, true);
+    run_volume_test(arm_func, orig_func, 6, 2, true, true);
+    run_volume_test(arm_func, orig_func, 6, 3, true, true);
 }
 END_TEST
 #endif /* defined (__arm__) && defined (__linux__) */
@@ -207,11 +206,11 @@ START_TEST (svolume_orc_test) {
 
     pa_log_debug("Checking Orc svolume");
     for (i = 1; i <= 2; i++) {
-        for (j = 0; j < 7; j++)
-            run_volume_test(orc_func, orig_func, j, i, true, false);
+        for (j = 0; j < 7; j += i)
+            run_volume_test(orc_func, orig_func, j, i, true, j == 0);
     }
     run_volume_test(orc_func, orig_func, 7, 1, true, true);
-    run_volume_test(orc_func, orig_func, 7, 2, true, true);
+    run_volume_test(orc_func, orig_func, 6, 2, true, true);
 }
 END_TEST