1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-05 09:18:06 +03:00
Commit Graph

95 Commits

Author SHA1 Message Date
Andreas Schneider
5850ea6338 s4:torture:basic: Fix code spelling
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-14 21:45:30 +00:00
Amir Goldstein
682c77be74 s4:torture:basic: use milliseconds granularity in delayed_write_update7
The test sets an mtime with non zero nsec and verifies that
the timestamp of pre-close matches the timestamp after close-open.

This is a regression test for
https://bugzilla.samba.org/show_bug.cgi?id=6529

The bug speaks of loosing the milliseconds part of the timestamp,
but the test uses a value of 103*100ns for the sub-second part.

Meaning that if the backing filesystem has only milliseconds
granularity, the test practically checks that a value of
0 milliseconds is preserved, which will not have actually
caught the bug.

Also, with the default 'smbd getinfo ask sharemode = yes'
the test will fail if the filesystem truncates the sub-second part
to milliseconds granularity.

Use a non-zero milliseconds value with zero microseconds in the test
to support backing filesystems with milliseconds granularity.

Signed-off-by: Amir Goldstein <amir@ctera.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar  1 20:55:47 UTC 2023 on atb-devel-224
2023-03-01 20:55:47 +00:00
Amir Goldstein
122d645868 s4:torture:basic: fix SET_INFO_* macros in delayed_write_update*
The macros were ignoring the finfo argument.

Signed-off-by: Amir Goldstein <amir@ctera.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2023-03-01 19:55:32 +00:00
Mathieu Parent
619e8f46d8 Spelling fixes s/ upto / up to /
Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-09-01 22:21:27 +00:00
Mathieu Parent
2bde81db39 Fix spelling s/doens't/doesn't/
Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2018-05-12 02:09:26 +02:00
Herb Lewis
7dec1e1eb1 delete duplicate test
Signed-off-by: Herb Lewis <herb@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>

Autobuild-User(master): Herb Lewis <herb@samba.org>
Autobuild-Date(master): Sat Jul  8 05:57:55 CEST 2017 on sn-devel-144
2017-07-08 05:57:55 +02:00
Jeremy Allison
c99994eb5a s4: torture: Pass TALLOC_CTX * to torture_delay_write().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
2017-05-05 15:52:11 +02:00
Michael Adam
ca9e46d130 s4:torture:basic: eliminate potential for false failures in delayed_write_update1c
We want to test that the write did update the write time immediately.
We check this by getting the file info in a loop for a few seconds.
There are several result cases:

- the server updated the write time immediately - success
- the server updated the write time, but not immediately - failure
- the server did not update the write time - failure

The loop is only there to be able to discern between the two
failure cases. The check for success is whether the first
getinfo has reportet the updated write time.

The potential for false failures was the additional timing check.
So if the first fileinfo call just took too long (e.g. due to a
busy system), this was reported as failure.

This patch should eliminate interemittent autobuild failures.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:06 +02:00
Michael Adam
95d333f03d s4:torture:basic: use assert in the second loop in delayed_write_update1b
We can hence replace the assert after the loop by a success torture_comment.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:06 +02:00
Michael Adam
8d198769d4 s4:torture:basic: add check for size after initial write in delayed_write_update1c
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:06 +02:00
Michael Adam
874788f4ce s4:torture:basic: add update into past as error condition in delayed_write_update1c
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:06 +02:00
Michael Adam
884f747678 s4:torture:basic: make use of torture_assert macros in delayed_write_update1c
This does not change the logic except for adding early
returns in failure cases.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:06 +02:00
Michael Adam
641a8a2575 s4:torture:basic: whitespace cleanup in delayed_write_update1c
no diff with git diff -w

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:06 +02:00
Michael Adam
970ae65a9d s4:torture:basic: eliminate potential for false failures in delayed_write_update1b
We want to test that the write did update the write time immediately.
We check this by getting the file info in a loop for a few seconds.
There are several result cases:

- the server updated the write time immediately - success
- the server updated the write time, but not immediately - failure
- the server did not update the write time - failure

The loop is only there to be able to discern between the two
failure cases. The check for success is whether the first
getinfo has reportet the updated write time.

The potential for false failures was the additional timing check.
So if the first fileinfo call just took too long (e.g. due to a
busy system), this was reported as failure.

This patch should eliminate interemittent autobuild failures.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:06 +02:00
Michael Adam
2907950f13 s4:torture:basic: use assert in the second loop in delayed_write_update1b
We can hence replace the assert after the loop by a success torture_comment.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:06 +02:00
Michael Adam
08432cd88f s4:torture:basic: add check for size after initial write in delayed_write_update1b
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:06 +02:00
Michael Adam
339f2fb589 s4:torture:basic: add update into past as error condition in delayed_write_update1b
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:06 +02:00
Michael Adam
dbb3a546a5 s4:torture:basic: make use of torture_assert macros in delayed_write_update1b
This does not change the logic except for adding early
returns in failure cases.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:06 +02:00
Michael Adam
c0cbad7892 s4:torture:basic: whitespace cleanup in delayed_write_update1b
no diff with git diff -w

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
372d91b38b s4:torture:basic: eliminate potential for false failures in delayed_write_update1a
We want to test that the write did update the write time immediately.
We check this by getting the file info in a loop for a few seconds.
There are several result cases:

- the server updated the write time immediately - success
- the server updated the write time, but not immediately - failure
- the server did not update the write time - failure

The loop is only there to be able to discern between the two
failure cases. The check for success is whether the first
getinfo has reportet the updated write time.

The potential for false failures was the additional timing check.
So if the first fileinfo call just took too long (e.g. due to a
busy system), this was reported as failure.

This patch should eliminate interemittent autobuild failures.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
2e1cb12848 s4:torture:basic: use assert in the second loop in delayed_write_update1a
We can hence replace the assert after the loop by a success torture_comment.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
de8dcdef3e s4:torture:basic: add check for size after initial write in delayed_write_update1a
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
17c78b9711 s4:torture:basic: add update into past as error condition in delayed_write_update1a
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
218a14f1a3 s4:torture:basic: make use of torture_assert macros in delayed_write_update1a
This does not change the logic except for adding early
returns in failure cases.
But it makes the code more compact and obvious.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
e99a550ccb s4:torture:basic: fix spacing in the delayed_write_update1a test.
No diff visible with git diff -w

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
1d2d0bc78f s4:torture:basic: eliminate potential for false failures in delayed_write_update1
We want to test that the write did update the write time immediately.
We check this by getting the file info in a loop for a few seconds.
There are several result cases:

- the server updated the write time immediately - success
- the server updated the write time, but not immediately - failure
- the server did not update the write time - failure

The loop is only there to be able to discern between the two
failure cases. The check for success is whether the first
getinfo has reportet the updated write time.

The potential for false failures was the additional timing check.
So if the first fileinfo call just took too long (e.g. due to a
busy system), this was reported as failure.

This patch should eliminate interemittent autobuild failures.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
bc93c8249b s4:torture:basic: use assert in the second loop in delayed_write_update1
We can hence replace the assert after the loop by a success torture_comment.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
91c5940421 s4:torture:basic: add check for size after initial write to delayed_write_update1
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
32dee459dc s4:torture:basic: add update into past as error condition in delayed_write_update1
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
4808e3d3ee s4:torture:basic: make use of torture_assert macros in delayed_write_update1
No logic change except for adding early returns.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
5d8a498536 s4:torture:basic: whitespace fix in delayed_write_update1
No diff with git diff -w

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
dc9ea4f849 s4:torture:basic: remove two unused variables from delayed_write_update3c
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
4df94065c7 s4:torture:basic: use torture_assert macros in delayed_write_update
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Michael Adam
6cb9d976cf s4:torture:basic: whitespace cleanup in delayed_write_update
git diff -w shows no diff

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-10-03 08:34:05 +02:00
Andrew Bartlett
f45f2d0116 torture: Remove confusing reference to (1 sec == 0.25)
The write should never update the time, so the fraction of the write
time delay we use is not important.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jun 24 01:44:06 CEST 2014 on sn-devel-104
2014-06-24 01:44:06 +02:00
Andrew Bartlett
f3f2b52f9f torture: tidy up whitespace for clarity
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-23 23:30:14 +02:00
Andrew Bartlett
00a83effc1 selftest: Run base.delaywrite against plugin_s4_dc only, and with kerberos for faster connections
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-23 23:30:14 +02:00
Andrew Bartlett
0e224698f7 torture-base.delaywrite: assert the for a delayed write, that it just takes longer than our configured delay
This removes the hardcoded TIMEDELAY_SECS that was then made variable
by the confusing "secs" variable

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-23 23:30:14 +02:00
Andrew Bartlett
f407f58fd3 torture: Only error if the write time was updated is less than the expected delay
The previous test was far, far too tight, it was in seconds 1/4 of the
fraction of the normal delay we had configured Samba to use so (1/4) *
(500 000 / 2000 000) = 1/16 (sec).  This margin appears to just be too
tight for our loaded test server.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-23 23:30:14 +02:00
Andrew Bartlett
24a73bb526 torture: Store writetimeupdatedelay in a double to allow easier comparison
In particular, this avoids a comparison with
double diff = timeval_elapsed() being promoted to an integer.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-23 23:30:14 +02:00
Andrew Bartlett
37e7b5a1b0 torture: convert torture_comment() -> torture_result() so we can knownfail flapping base.delaywrite tests
This only changes instances directly before a return false, ret =
false or goto fail statement.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Jun 12 10:39:38 CEST 2014 on sn-devel-104
2014-06-12 10:39:38 +02:00
Andrew Bartlett
1bdc635f1d selftest: Remove reduction in time window in delaywrite test
This causes flakey autobuilds from time to time.

The reduction in the time window to 30% was added in:

commit c2df97f57c
Author: Jeremy Allison <jra@samba.org>
Date:   Thu Nov 5 15:37:26 2009 -0800

    Fix up some of the timing constants for DELAYWRITE. Add some extra tests up test_delayed_write_update6
    to investigate what happens to a sticky write handle after a second handle close.
    Jeremy.

The original reduction to 75% was set in the new code

commit 0d0fddf8ae
Author: Jeremy Allison <jra@samba.org>
Date:   Fri Sep 5 14:24:36 2008 -0700

    Added tests that show that write time update is immediate
    when changing file size using SMBwrite of size zero,
    SET_END_OF_FILE, or SET_ALLOCATION_SIZE - no 2 second
    delay in these cases.
    Jeremy.
    (This used to be commit 3aa7523d77)

and in:

commit edb3a83a06
Author: Stefan Metzmacher <metze@samba.org>
Date:   Tue Apr 8 10:25:51 2008 +0200

    BASE-DELAYWRITE: use timeval_* and make it possible to spefic the writetime update delay

    metze
    (This used to be commit 751ab2992a)

Change-Id: I8ff9fb8a8b66308f6d784351a0f43b5b234889d1
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-04-02 00:31:48 +02:00
Jeremy Allison
48f426b22d smbtorture: New torture test for bug #9870.
Not fetching the latest modification time on a folder if we have read locks on it.

Prove we should just rely on the mtime value from the underlying
filesystem, even with an open handle.

  BUG: https://bugzilla.samba.org/show_bug.cgi?id=9870

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Dec  5 10:05:06 CET 2013 on sn-devel-104
2013-12-05 10:05:06 +01:00
Volker Lendecke
f01013b1a4 s4-torture: Fix some nonemtpy blank lines 2012-09-25 07:22:43 -07:00
Andrew Bartlett
45082a88c7 s4-torture: Improve torture test boilerplate, use torture_assert()
This ensures that if this fails, it is reported as a subunit error correctly.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Fri May 18 09:35:13 CEST 2012 on sn-devel-104
2012-05-18 09:35:13 +02:00
Jeremy Allison
3e6e1aed94 Fix a bunch of "warning: variable ‘XXXX’ set but not used [-Wunused-but-set-variable]" warnings from the new gcc.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Nov 21 23:39:08 CET 2011 on sn-devel-104
2011-11-21 23:39:08 +01:00
Jelmer Vernooij
be9f1ca1c6 source4/torture/basic: Fix prototypes for all functions. 2011-03-19 03:20:04 +01:00
Jelmer Vernooij
35fbc7bbda s4-smbtorture: Make test names lowercase and dot-separated.
This is consistent with the test names used by selftest, should
make the names less confusing and easier to integrate with other tools.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Dec 11 04:16:13 CET 2010 on sn-devel-104
2010-12-11 04:16:13 +01:00
Björn Jacke
2b254c814b s3/s4: merge msleep and smb_msleep
the merged variant is renamed to smb_msleep as some platforms already have a
msleep function.
2010-09-16 21:38:20 +02:00
Jeremy Allison
c2df97f57c Fix up some of the timing constants for DELAYWRITE. Add some extra tests up test_delayed_write_update6
to investigate what happens to a sticky write handle after a second handle close.
Jeremy.
2009-11-05 15:37:26 -08:00