<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 04/22/2010 12:23 AM, Stew Benedict wrote:
<blockquote cite="mid:4BCF5EA8.2030305@linux-foundation.org" type="cite">
  <pre wrap="">I've attached modifications to test snd_pcm_open, following Alexey's
tutorial as best I could. Please review and comment. I'm still having
some trouble wrapping my head around things.

Questions in my mind:

1) seems like I should have a snd_pcm_close() in there somewhere, but I
either ended up with segfaults or child exiting with signal 6 when I
tried to add it to the test
2) the -1 in the sequence was intended to give me a &lt;0 result to test
req-06.02, but it didn't really happen. I'm not sure how to force the
error condition

  </pre>
</blockquote>
<br>
Hello,<br>
I've tried to run the same test on my work station (ALSA v1.0.22):<br>
<br>
------------------code----------------------<br>
#include &lt;alsa/asoundlib.h&gt;<br>
int main(int argc, char *argv[ ])<br>
{<br>
&nbsp;&nbsp;&nbsp; snd_pcm_t* pcm = 0;<br>
&nbsp;&nbsp;&nbsp; int res = snd_pcm_open(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (snd_pcm_t**)&amp;pcm,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "hw:0",<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -1,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SND_PCM_NONBLOCK); //target call<br>
&nbsp;&nbsp;&nbsp; printf("res=%d\n", res);<br>
&nbsp;&nbsp;&nbsp; return 0;<br>
}<br>
------------------/code----------------------<br>
<br>
And it reports:<br>
<br>
ALSA lib pcm_hw.c:1268:(snd_pcm_hw_open) invalid stream -1<br>
res=-22<br>
<br>
Also I have run test for snd_pcm_close:<br>
<br>
------------------code----------------------<br>
#include &lt;alsa/asoundlib.h&gt;<br>
int main(int argc, char *argv[ ])<br>
{<br>
&nbsp;&nbsp;&nbsp; snd_pcm_t* pcm = 0;<br>
&nbsp;&nbsp;&nbsp; snd_pcm_open(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (snd_pcm_t**)&amp;pcm,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "hw:0",<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SND_PCM_STREAM_PLAYBACK,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SND_PCM_NONBLOCK); //target call<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; int res = snd_pcm_close(pcm);<br>
&nbsp;&nbsp;&nbsp; printf("res=%d\n", res);<br>
&nbsp;&nbsp;&nbsp; return 0;<br>
}<br>
------------------/code----------------------<br>
<br>
And it reports:<br>
res=0<br>
<br>
So snd_pcm_close and snd_pcm_open work as expected at least on my
station.<br>
<br>
The signal 6 (ABRT) your received possibly means that your pcm is NULL
(passed to snd_pcm_close and then aborted). Try to check it before
passing to snd_pcm_close (standalone test without both tet and t2c):<br>
<br>
------------------code----------------------<br>
#include &lt;alsa/asoundlib.h&gt;<br>
int main(int argc, char *argv[ ])<br>
{<br>
&nbsp;&nbsp;&nbsp; snd_pcm_t* pcm = 0;<br>
&nbsp;&nbsp;&nbsp; snd_pcm_open(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (snd_pcm_t**)&amp;pcm,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "hw:0",<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SND_PCM_STREAM_PLAYBACK,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SND_PCM_NONBLOCK); //target call<br>
&nbsp;&nbsp;&nbsp; printf("pcm=%d\n", (int)pcm);<br>
&nbsp;&nbsp;&nbsp; snd_pcm_close(pcm);<br>
&nbsp;&nbsp;&nbsp; return 0;<br>
}<br>
------------------/code----------------------<br>
<br>
<blockquote cite="mid:4BCF5EA8.2030305@linux-foundation.org" type="cite">
  <pre wrap="">200|15 17 16:01:16|TP Start
520|15 17 00015442 1 1|Test target(s):
520|15 17 00015442 1 2|snd_pcm_open
520|15 17 00015442 1 3|--------
520|15 17 00015442 1 4|Checked requirement: {snd_pcm_open.06.01}
220|15 17 0 16:01:16|PASS
410|15 17 1 16:01:16|IC End
400|15 18 1 16:01:16|IC Start
200|15 18 16:01:16|TP Start
520|15 18 00015443 1 1|Test target(s):
520|15 18 00015443 1 2|snd_pcm_open
520|15 18 00015443 1 3|--------
520|15 18 00015443 1 4|Checked requirement: {snd_pcm_open.06.01}
220|15 18 0 16:01:16|PASS
410|15 18 1 16:01:16|IC End
400|15 19 1 16:01:16|IC Start
200|15 19 16:01:16|TP Start
520|15 19 00015444 1 1|Test target(s):
520|15 19 00015444 1 2|snd_pcm_open
520|15 19 00015444 1 3|--------
520|15 19 00015444 1 4|Checked requirement: {snd_pcm_open.06.01}
220|15 19 0 16:01:16|PASS
410|15 19 1 16:01:16|IC End

Finally, I'm having a hard time understanding the relationship between
the marked up specs and the tests. I sort of expected these requirements
to get populated with meaningful info in the test journal, but even with
Alexey's example, we just get interface.xx, which one would have to go
back to the marked up spec to find out what requirement is being tested,
and why things are failing.

I'm thinking that it's due to the way things are currently setup, with
tests being in files named differently than the marked up spec, but
maybe my expectations are just wrong. I'm not seeing how the tests are
tied to the marked up spec, aside from the copy/paste operations to the
req(s) into the test.

Example(s):

snd_card_next:
spec: group_control.html
catalog generated from spec: group_control.xml
test_code: ALSA_Control_Interface.t2c
catalog corresponding to test code: ALSA_Control_Interface.xml

snd_pcm_open:
spec: group___p_c_m.html
catalog generated from spec: group___p_c_m.xml
test code: ALSA_PCM_Interface_General_Functions.t2c
catalog corresponding to test code: ALSA_PCM_Interface_General_Functions.xml

  </pre>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
lsb-discuss mailing list
<a class="moz-txt-link-abbreviated" href="mailto:lsb-discuss@lists.linux-foundation.org">lsb-discuss@lists.linux-foundation.org</a>
<a class="moz-txt-link-freetext" href="https://lists.linux-foundation.org/mailman/listinfo/lsb-discuss">https://lists.linux-foundation.org/mailman/listinfo/lsb-discuss</a>
  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Andrey Ponomarenko

Linux Verification Center, ISPRAS
 web:    <a class="moz-txt-link-freetext" href="http://www.linuxtesting.org">http://www.linuxtesting.org</a></pre>
</body>
</html>