Bug 8068 - RAW-STREAMS/test_stream_create_disposition subtest fails on Windows CIFS server due test logical error
RAW-STREAMS/test_stream_create_disposition subtest fails on Windows CIFS serv...
Status: RESOLVED FIXED
Product: Samba 4.0
Classification: Unclassified
Component: smbtorture
unspecified
x86 Linux
: P5 normal
: ---
Assigned To: Andrew Bartlett
samba4-qa@samba.org
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-07 12:56 UTC by Volodymyr Khomenko
Modified: 2012-03-29 07:07 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volodymyr Khomenko 2011-04-07 12:56:24 UTC
When running RAW-STREAMS on CIFS server winXP/win2k3/win2k8, we receive the same message from test_stream_create_disposition subtest:

[root@test source4]# bin/smbtorture //10.64.164.2/cifs_share -U QA/Admin%password RAW-STREAMS
Using seed 1302178785
test: STREAMS
...
(torture/raw/streams.c:1401) Checking ntcreatex disp: open
(torture/raw/streams.c:1413) Checking ntcreatex disp: overwrite
(torture/raw/streams.c:1425) Checking ntcreatex disp: overwrite_if
(torture/raw/streams.c:1442) Checking ntcreatex disp: supersede
(torture/raw/streams.c:1460) Checking ntcreatex disp: overwrite_if on stream
(torture/raw/streams.c:162) expected 1 streams, got 2
(torture/raw/streams.c:1478) Checking openx disp: overwrite_if
...
success: STREAMS

I see that scenario with 'overwrite_if on stream' always fails because 'expected to receive 1 streams, but got 2'. I think this check is incorrect.

Problematic scenario:
1. A file with one stream is created ('stream.txt' and 'stream.txt:Stream One:$DATA').
2. We opens a stream with overwrite_if flag (stream must be reset).
3. We check the file for streams and expect only 1 stream (why???) but we got default stream (::$SATA) and overwritten stream (Stream One:$DATA).

Seems like step #3 should be fixed: we should expect 2 streams.

Note - this subtest (although we have failures) doesn't make the whole test to fail because we have 'bool ret = true;' in the test_stream_create_disposition(). This means that any failure (after 'goto done') is ignored, test is always reported with "success".
I think this is not desired and should be fixed too.

Proposed fix:
--- source4/torture/raw/streams.c.orig
+++ source4/torture/raw/streams.c
@@ -1351,7 +1351,7 @@ static bool test_stream_create_dispositi
        const char *fname_stream;
        const char *default_stream_name = "::$DATA";
        const char *stream_list[2];
-       bool ret = true;
+       bool ret = false;
        int fnum = -1;

        fname_stream = talloc_asprintf(mem_ctx, "%s:%s", fname, stream);
@@ -1450,7 +1450,7 @@ static bool test_stream_create_dispositi
        status = smb_raw_open(cli->tree, mem_ctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
        smbcli_close(cli->tree, io.ntcreatex.out.file.fnum);
-       if (!check_stream_list(cli, fname, 1, &default_stream_name)) {
+       if (!check_stream_list(cli, fname, 2, stream_list)) {
                goto done;
        }

@@ -1480,6 +1480,7 @@ static bool test_stream_create_dispositi
        if (!check_stream_list(cli, fname, 1, &default_stream_name)) {
                goto done;
        }
+       ret = true; /* All steps are ok, subtest is succeeded */

  done:
        smbcli_close(cli->tree, fnum);



P.S. smbtorture sources have been fetched from samba-3.5.6.tar.gz, compiled from 'source4' subtree .

Thanks.
Comment 1 Matthias Dieter Wallnöfer 2012-03-27 14:45:06 UTC
Metze, could we apply this patch?
Comment 2 Stefan Metzmacher 2012-03-29 07:07:15 UTC
see 5d66d43667f9356b50dad5555e6b5ed04b7a4fd2