jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jack_property_test.sh 4.4KB

Add script to test jack_property (Metadata) Running script 'jack_property_test.sh' with recent jack1 and jack2 git builds show different results. Notes: -jack1 gives only false positives due to a small text change -jack2 has issues using client name as subject/identifier/uuid -> see '** FAILED' lines -jack1 is much faster in performing the same script -running the script in a loop causes memory problems with jack2 output running with jack1: test system_c1: jack_property -D OK: 0 ** FAILED: JACK metadata successfully delete ** EXP EQ: JACK metadata successfully deleted test system_c2: jack_property -l OK: 0 OK: test system_c3: jack_property -c -l system OK: 0 OK: test system_c4: jack_property -c -s system client_key client_value OK: 0 OK: test system_c5: jack_property -c -l system OK: 0 OK: key: client_key value: client_value test system_c6: jack_property -c -l system client_key OK: 0 OK: client_value test system_c7: jack_property -l OK: 0 OK: key: client_key value: client_value test system_c8: jack_property -p -l system:non OK: 0 OK: cannot find port name system:non test system_p1: jack_property -D OK: 0 ** FAILED: JACK metadata successfully delete ** EXP EQ: JACK metadata successfully deleted test system_p2: jack_property -l OK: 0 OK: test system_p3: jack_property -p -l system:playback_1 OK: 0 OK: test system_p4: jack_property -p -s system:playback_1 port_key port_value OK: 0 OK: test system_p5: jack_property -p -l system:playback_1 OK: 0 OK: key: port_key value: port_value test system_p6: jack_property -p -l system:playback_1 port_key OK: 0 OK: port_value test system_p7: jack_property -p -d system:playback_1 port_key OK: 0 OK: test system_p8: jack_property -p -l system:playback_1 port_key OK: 0 OK: Value not found for port_key of system:playback_1 test system_p9: jack_property -p -d system:playback_1 port_key OK: 0 OK: "port_key" property not removed for system:playback_1 test system_p10: jack_property -p -l system:playback_1 OK: 0 OK: test system_p11: jack_property -p -l system:playback_1 non OK: 0 OK: Value not found for non of system:playback_1 test system_p12: jack_property -c -l non OK: 0 OK: cannot get UUID for client named non metro:120_bpm test metro_c1: jack_property -D OK: 0 ** FAILED: JACK metadata successfully delete ** EXP EQ: JACK metadata successfully deleted test metro_c2: jack_property -l OK: 0 OK: test metro_c3: jack_property -c -l metro OK: 0 OK: test metro_c4: jack_property -c -s metro client_key client_value OK: 0 OK: test metro_c5: jack_property -c -l metro OK: 0 OK: key: client_key value: client_value test metro_c6: jack_property -c -l metro client_key OK: 0 OK: client_value test metro_c7: jack_property -l OK: 0 OK: key: client_key value: client_value test metro_c8: jack_property -p -l metro:non OK: 0 OK: cannot find port name metro:non test metro_p1: jack_property -D OK: 0 ** FAILED: JACK metadata successfully delete ** EXP EQ: JACK metadata successfully deleted test metro_p2: jack_property -l OK: 0 OK: test metro_p3: jack_property -p -l metro:120_bpm OK: 0 OK: test metro_p4: jack_property -p -s metro:120_bpm port_key port_value OK: 0 OK: test metro_p5: jack_property -p -l metro:120_bpm OK: 0 OK: key: port_key value: port_value test metro_p6: jack_property -p -l metro:120_bpm port_key OK: 0 OK: port_value test metro_p7: jack_property -p -d metro:120_bpm port_key OK: 0 OK: test metro_p8: jack_property -p -l metro:120_bpm port_key OK: 0 OK: Value not found for port_key of metro:120_bpm test metro_p9: jack_property -p -d metro:120_bpm port_key OK: 0 OK: "port_key" property not removed for metro:120_bpm test metro_p10: jack_property -p -l metro:120_bpm OK: 0 OK: test metro_p11: jack_property -p -l metro:120_bpm non OK: 0 OK: Value not found for non of metro:120_bpm test metro_p12: jack_property -c -l non OK: 0 OK: cannot get UUID for client named non JACK metadata successfully delete ./jack_property_test.sh: line 215: 21025 Hangup jack_metro -b120 done, exit status is 1 real 0m1.011s user 0m0.125s sys 0m0.324s ========================================== output running with jack2: test system_c1: jack_property -D OK: 0 OK: JACK metadata successfully deleted test system_c2: jack_property -l OK: 0 OK: test system_c3: jack_property -c -l system OK: 0 OK: test system_c4: jack_property -c -s system client_key client_value OK: 0 OK: test system_c5: jack_property -c -l system OK: 0 OK: key: client_key value: client_value test system_c6: jack_property -c -l system client_key OK: 0 OK: client_value test system_c7: jack_property -l OK: 0 OK: key: client_key value: client_value test system_c8: jack_property -p -l system:non OK: 0 OK: cannot find port name system:non test system_p1: jack_property -D OK: 0 OK: JACK metadata successfully deleted test system_p2: jack_property -l OK: 0 OK: test system_p3: jack_property -p -l system:playback_1 OK: 0 OK: test system_p4: jack_property -p -s system:playback_1 port_key port_value OK: 0 OK: test system_p5: jack_property -p -l system:playback_1 OK: 0 OK: key: port_key value: port_value test system_p6: jack_property -p -l system:playback_1 port_key OK: 0 OK: port_value test system_p7: jack_property -p -d system:playback_1 port_key OK: 0 OK: test system_p8: jack_property -p -l system:playback_1 port_key OK: 0 OK: Value not found for port_key of system:playback_1 test system_p9: jack_property -p -d system:playback_1 port_key OK: 0 OK: "port_key" property not removed for system:playback_1 test system_p10: jack_property -p -l system:playback_1 OK: 0 OK: test system_p11: jack_property -p -l system:playback_1 non OK: 0 OK: Value not found for non of system:playback_1 test system_p12: jack_property -c -l non OK: 0 OK: cannot get UUID for client named non metro:120_bpm test metro_c1: jack_property -D OK: 0 OK: JACK metadata successfully deleted test metro_c2: jack_property -l OK: 0 OK: test metro_c3: jack_property -c -l metro ** FAILED: 255 ** EXP EQ: 0 ** FAILED: cannot parse client UUID as UUID ** EXP EQ: test metro_c4: jack_property -c -s metro client_key client_value ** FAILED: 255 ** EXP EQ: 0 ** FAILED: cannot parse client UUID as UUID ** EXP EQ: test metro_c5: jack_property -c -l metro ** FAILED: 255 ** EXP EQ: 0 ** FAILED: cannot parse client UUID as UUID ** EXP EQ: key: client_key value: client_value test metro_c6: jack_property -c -l metro client_key ** FAILED: 255 ** EXP EQ: 0 ** FAILED: cannot parse client UUID as UUID ** EXP EQ: client_value test metro_c7: jack_property -l OK: 0 ** FAILED: ** EXP EQ: key: client_key value: client_value test metro_c8: jack_property -p -l metro:non OK: 0 OK: cannot find port name metro:non test metro_p1: jack_property -D OK: 0 OK: JACK metadata successfully deleted test metro_p2: jack_property -l OK: 0 OK: test metro_p3: jack_property -p -l metro:120_bpm OK: 0 OK: test metro_p4: jack_property -p -s metro:120_bpm port_key port_value OK: 0 OK: test metro_p5: jack_property -p -l metro:120_bpm OK: 0 OK: key: port_key value: port_value test metro_p6: jack_property -p -l metro:120_bpm port_key OK: 0 OK: port_value test metro_p7: jack_property -p -d metro:120_bpm port_key OK: 0 OK: test metro_p8: jack_property -p -l metro:120_bpm port_key OK: 0 OK: Value not found for port_key of metro:120_bpm test metro_p9: jack_property -p -d metro:120_bpm port_key OK: 0 OK: "port_key" property not removed for metro:120_bpm test metro_p10: jack_property -p -l metro:120_bpm OK: 0 OK: test metro_p11: jack_property -p -l metro:120_bpm non OK: 0 OK: Value not found for non of metro:120_bpm test metro_p12: jack_property -c -l non OK: 0 OK: cannot get UUID for client named non JACK metadata successfully deleted signal received, exiting ... done, exit status is 1 real 0m2.806s user 0m0.176s sys 0m0.374s
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. #!/bin/bash
  2. #test jack_property client
  3. #//tb/1902
  4. #this test needs:
  5. # -a running jack server
  6. # -client programs
  7. # -jack_property
  8. # -jack_metro
  9. # -jack_lsp
  10. #uninstall jack, setup jack1, make sure /dev/shm/ is clean, start jackd -ddummy in new terminal, run this script in new terminal
  11. # time ./jack_property_test.sh > /tmp/jack_property_test_jack1_out.txt 2>&1
  12. #uninstall jack, setup jack2, make sure /dev/shm/ is clean, start jackd -ddummy in new terminal, run this script in new terminal
  13. # time ./jack_property_test.sh > /tmp/jack_property_test_jack2_out.txt 2>&1
  14. #for stress test: while true; do ./jack_property_test.sh; sleep 1; done
  15. #to inspect running script: start with bash -x ./jack_property_test.sh
  16. set -o pipefail
  17. #any failed test will set this to 1 (error)
  18. FINAL_RETURN_VALUE=0
  19. function expect()
  20. {
  21. if [ "$1" = "$2" ];
  22. then
  23. echo " OK: $2"
  24. return 0
  25. fi
  26. echo "** FAILED: $1"
  27. echo "** EXP EQ: $2"
  28. FINAL_RETURN_VALUE=1
  29. return 1
  30. }
  31. function expect_not()
  32. {
  33. if [ "$1" != "$2" ];
  34. then
  35. echo " OK: $2"
  36. return 0
  37. fi
  38. echo "** FAILED: $1"
  39. echo "** EXP NE: $2"
  40. FINAL_RETURN_VALUE=1
  41. return 1
  42. }
  43. function expect_ok_empty()
  44. {
  45. expect "$1" 0
  46. expect "$2" ""
  47. }
  48. TESTPREFIX=""
  49. function tell()
  50. {
  51. echo "test ${TESTPREFIX}$1: $2"
  52. }
  53. #test using -c, --client
  54. function client_test()
  55. {
  56. client="$1"
  57. cmd="jack_property -D"
  58. tell c1 "$cmd"
  59. res="`$cmd 2>&1`"
  60. expect $? 0
  61. expect "$res" "JACK metadata successfully deleted"
  62. cmd="jack_property -l"
  63. tell c2 "$cmd"
  64. res="`$cmd 2>&1`"
  65. expect_ok_empty $? "$res"
  66. cmd="jack_property -c -l $client"
  67. tell c3 "$cmd"
  68. res="`$cmd 2>&1`"
  69. expect_ok_empty $? "$res"
  70. cmd="jack_property -c -s $client client_key client_value"
  71. tell c4 "$cmd"
  72. res="`$cmd 2>&1`"
  73. expect_ok_empty $? "$res"
  74. cmd="jack_property -c -l $client"
  75. tell c5 "$cmd"
  76. res="`$cmd 2>&1`"
  77. expect $? 0
  78. expect "$res" "key: client_key value: client_value"
  79. cmd="jack_property -c -l $client client_key"
  80. tell c6 "$cmd"
  81. res="`$cmd 2>&1`"
  82. expect $? 0
  83. expect "$res" "client_value"
  84. cmd="jack_property -l" # |tail -1"
  85. tell c7 "$cmd"
  86. res="`$cmd 2>&1 |tail -1`"
  87. #18446744073709551615
  88. #key: client_key value: client_value
  89. expect $? 0
  90. expect "$res" "key: client_key value: client_value"
  91. cmd="jack_property -p -l ${client}:non"
  92. tell c8 "$cmd"
  93. res="`$cmd 2>&1`"
  94. expect_not $? 0
  95. expect "$res" "cannot find port name ${client}:non"
  96. }
  97. #test using -p, --port
  98. function port_test()
  99. {
  100. port="$1"
  101. cmd="jack_property -D"
  102. tell p1 "$cmd"
  103. res="`$cmd 2>&1`"
  104. expect $? 0
  105. expect "$res" "JACK metadata successfully deleted"
  106. cmd="jack_property -l"
  107. tell p2 "$cmd"
  108. res="`$cmd 2>&1`"
  109. expect_ok_empty $? "$res"
  110. cmd="jack_property -p -l $port"
  111. tell p3 "$cmd"
  112. res="`$cmd 2>&1`"
  113. expect_ok_empty $? "$res"
  114. cmd="jack_property -p -s $port port_key port_value"
  115. tell p4 "$cmd"
  116. res="`$cmd 2>&1`"
  117. expect_ok_empty $? "$res"
  118. cmd="jack_property -p -l $port"
  119. tell p5 "$cmd"
  120. res="`$cmd 2>&1`"
  121. expect $? 0
  122. expect "$res" "key: port_key value: port_value"
  123. cmd="jack_property -p -l $port port_key"
  124. tell p6 "$cmd"
  125. res="`$cmd 2>&1`"
  126. expect $? 0
  127. expect "$res" "port_value"
  128. cmd="jack_property -p -d $port port_key"
  129. tell p7 "$cmd"
  130. res="`$cmd 2>&1`"
  131. expect_ok_empty $? "$res"
  132. cmd="jack_property -p -l $port port_key"
  133. tell p8 "$cmd"
  134. res="`$cmd 2>&1`"
  135. expect_not $? 0
  136. expect "$res" "Value not found for port_key of $port"
  137. cmd="jack_property -p -d $port port_key"
  138. tell p9 "$cmd"
  139. res="`$cmd 2>&1 |tail -1`"
  140. #Cannot delete key port_key (BDB0073 DB_NOTFOUND: No matching key/data pair found)
  141. #"port_key" property not removed for system:playback_1
  142. expect_not $? 0
  143. expect "$res" "\"port_key\" property not removed for $port"
  144. cmd="jack_property -p -l $port"
  145. tell p10 "$cmd"
  146. res="`$cmd 2>&1`"
  147. expect_ok_empty $? "$res"
  148. cmd="jack_property -p -l $port non"
  149. tell p11 "$cmd"
  150. res="`$cmd 2>&1`"
  151. expect_not $? 0
  152. expect "$res" "Value not found for non of $port"
  153. cmd="jack_property -c -l non"
  154. tell p12 "$cmd"
  155. res="`$cmd 2>&1`"
  156. expect_not $? 0
  157. expect "$res" "cannot get UUID for client named non"
  158. }
  159. TESTPREFIX="system_"
  160. client_test system
  161. port_test system:playback_1
  162. #test with any jack client
  163. jack_metro -b120 &
  164. metro_pid=$!
  165. sleep 0.1
  166. jack_lsp|grep metro
  167. #metro:120_bpm
  168. TESTPREFIX="metro_"
  169. client_test metro
  170. port_test metro:120_bpm
  171. jack_property -D
  172. #JACK metadata successfully deleted
  173. jack_property -l
  174. kill -HUP $metro_pid
  175. sleep 0.5
  176. echo "done, exit status is $FINAL_RETURN_VALUE"
  177. ###TO DO:
  178. #test short keys, values
  179. #test long keys, values
  180. #test many
  181. exit $FINAL_RETURN_VALUE
  182. #EOF