qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 8db193: tests/9pfs: make create/remove test d


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 8db193: tests/9pfs: make create/remove test dir public
Date: Mon, 02 Nov 2020 08:05:31 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 8db193c4108e09996923a4d716b51fc98efb7f3a
      
https://github.com/qemu/qemu/commit/8db193c4108e09996923a4d716b51fc98efb7f3a
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/libqos/virtio-9p.c
    M tests/qtest/libqos/virtio-9p.h

  Log Message:
  -----------
  tests/9pfs: make create/remove test dir public

Make functions create_local_test_dir() and remove_local_test_dir()
public. They're going to be used in the next patch.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: 
<ec90703cbc23d6b612b3672f946d7741f4a16080.1604243521.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 136b7af22774a6f0fb44c9c1b8c088b52e2e92ed
      
https://github.com/qemu/qemu/commit/136b7af22774a6f0fb44c9c1b8c088b52e2e92ed
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/libqos/virtio-9p.c
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: fix test dir for parallel tests

Use mkdtemp() to generate a unique directory for the 9p 'local' tests.

This fixes occasional 9p test failures when running 'make check -jN' if
QEMU was compiled for multiple target architectures, because the individual
architecture's test suites would run in parallel and interfere with each
other's data as the test directory was previously hard coded and hence the
same directory was used by all of them simultaniously.

This also requires a change how the test directory is created and deleted:
As the test path is now randomized and virtio_9p_register_nodes() being
called in a somewhat undeterministic way, that's no longer an appropriate
place to create and remove the test directory. Use a constructor and
destructor function for creating and removing the test directory instead.
Unfortunately libqos currently does not support setup/teardown callbacks
to handle this more cleanly.

The constructor functions needs to be in virtio-9p-test.c, not in
virtio-9p.c, because in the latter location it would cause all apps that
link to libqos (i.e. entirely unrelated test suites) to create a 9pfs
test directory as well, which would even break other test suites.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Tested-by: Greg Kurz <groug@kaod.org>
Message-Id: 
<7746f42d8f557593898d3d9d8e57c46e872dfb4f.1604243521.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 5409d8bea40289106e1005c41973382a7dfacf1c
      
https://github.com/qemu/qemu/commit/5409d8bea40289106e1005c41973382a7dfacf1c
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/libqos/virtio-9p.c

  Log Message:
  -----------
  tests/9pfs: fix coverity error in create_local_test_dir()

Coverity wants the return value of mkdir() to be checked:

  /qemu/tests/qtest/libqos/virtio-9p.c: 48 in create_local_test_dir()
  42     /* Creates the directory for the 9pfs 'local' filesystem driver to
  access. */
  43     static void create_local_test_dir(void)
  44     {
  45         struct stat st;
  46
  47         g_assert(local_test_path != NULL);
  >>> CID 1435963:  Error handling issues  (CHECKED_RETURN)
  >>> Calling "mkdir(local_test_path, 511U)" without checking return value.
  This library function may fail and return an error code.
  48         mkdir(local_test_path, 0777);
  49
  50         /* ensure test directory exists now ... */
  51         g_assert(stat(local_test_path, &st) == 0);
  52         /* ... and is actually a directory */
  53         g_assert((st.st_mode & S_IFMT) == S_IFDIR);

So let's just do that and log an info-level message at least, because we
actually only care if the required directory exists and we do have an
existence check for that in place already.

Reported-by: Coverity (CID 1435963)
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: 
<03f68c7ec08064e20f43797f4eb4305ad21e1e8e.1604061839.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 603cc76a60691b288947c88ad63b7b0d616f98b6
      
https://github.com/qemu/qemu/commit/603cc76a60691b288947c88ad63b7b0d616f98b6
  Author: Greg Kurz <groug@kaod.org>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/libqos/virtio-9p.c

  Log Message:
  -----------
  tests/9pfs: Force removing of local 9pfs test directory

No need to get a complaint from "rm" if some path disappeared for some
reason.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160406199444.312256.8319835906008559151.stgit@bahia.lan>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 1c450e6efe14a7c76f4e75d7316c9fdf00e757c0
      
https://github.com/qemu/qemu/commit/1c450e6efe14a7c76f4e75d7316c9fdf00e757c0
  Author: Greg Kurz <groug@kaod.org>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: Factor out do_version() helper

fs_version() is a top level test function. Factor out the reusable
code to a separate helper instead of hijacking it in other tests.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160321015403.266767.4533967728943968456.stgit@bahia.lan>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 382619eff506bd229c7ba0d5671c84b6f1a0a415
      
https://github.com/qemu/qemu/commit/382619eff506bd229c7ba0d5671c84b6f1a0a415
  Author: Greg Kurz <groug@kaod.org>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: Set alloc in fs_create_dir()

fs_create_dir() is a top level test function. It should set alloc.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160321016764.266767.3763279057643874020.stgit@bahia.lan>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 3fe4baf47be2633022ed4af71466aca6ddfc3f19
      
https://github.com/qemu/qemu/commit/3fe4baf47be2633022ed4af71466aca6ddfc3f19
  Author: Greg Kurz <groug@kaod.org>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: Factor out do_attach() helper

fs_attach() is a top level test function. Factor out the reusable
code to a separate helper instead of hijacking it in other tests.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160321017450.266767.17377192504263871186.stgit@bahia.lan>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 1d98613d7cd488528bc08260185c03ee078c1347
      
https://github.com/qemu/qemu/commit/1d98613d7cd488528bc08260185c03ee078c1347
  Author: Greg Kurz <groug@kaod.org>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: Turn fs_readdir_split() into a helper

fs_readdir_split() isn't a top level test function and thus shouldn't
take the "void *obj, void *data, QGuestAllocator *t_alloc" arguments.
Turn it into a helper to be used by test functions.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160321016084.266767.9501523425012383531.stgit@bahia.lan>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: c1934f630c131ec487d21949c9b53e1e3f2b8bcb
      
https://github.com/qemu/qemu/commit/c1934f630c131ec487d21949c9b53e1e3f2b8bcb
  Author: Greg Kurz <groug@kaod.org>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: Turn fs_mkdir() into a helper

fs_mkdir() isn't a top level test function and thus shouldn't take
the "void *obj, void *data, QGuestAllocator *t_alloc" arguments.
Turn it into a helper to be used by test functions.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160321018148.266767.15959608711038504029.stgit@bahia.lan>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 20018805224c69c78ac25d6b361eded8c8095c75
      
https://github.com/qemu/qemu/commit/20018805224c69c78ac25d6b361eded8c8095c75
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: simplify do_mkdir()

Split out walking a directory path to a separate new utility function
do_walk() and use that function in do_mkdir().

The code difference saved this way is not much, but we'll use that new
do_walk() function in the upcoming patches, so it will avoid quite
some code duplication after all.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: 
<4d7275b2363f122438a443ce079cbb355285e9d6.1603285620.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: b37d62d6de08bea1f57e51a4b99938f7994a84d6
      
https://github.com/qemu/qemu/commit/b37d62d6de08bea1f57e51a4b99938f7994a84d6
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: add local Tunlinkat directory test

This test case uses a Tunlinkat 9p request with flag AT_REMOVEDIR
(see 'man 2 unlink') to remove a directory from host's test directory.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: 
<3c7c65b476ba44bea6afd0b378b5287e1c671a32.1603285620.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: b09dbfdd5177ccd49117b6e6ce6712db99714ee0
      
https://github.com/qemu/qemu/commit/b09dbfdd5177ccd49117b6e6ce6712db99714ee0
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: add local Tlcreate test

This test case uses a Tlcreate 9p request to create a regular file inside
host's test directory.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: 
<269cae0c00af941a3a4ae78f1e319f93462a7eb4.1603285620.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 472c18b8bf20f111b02abc403407efd88b6281d7
      
https://github.com/qemu/qemu/commit/472c18b8bf20f111b02abc403407efd88b6281d7
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: add local Tunlinkat file test

This test case uses a Tunlinkat request to remove a regular file using
the 9pfs 'local' fs driver.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: 
<4eabeed7f662721dd5664cb77fe36ea0aa08b1ec.1603285620.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 59ff563db1cfb9f3a20075b452d1564585bbc66a
      
https://github.com/qemu/qemu/commit/59ff563db1cfb9f3a20075b452d1564585bbc66a
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: add local Tsymlink test

This test case uses a Tsymlink 9p request to create a symbolic link using
the 9pfs 'local' fs driver.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: 
<84ac76937855bf441242372cc3e62df42f0a3dc4.1603285620.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 5b28ab8bda41768acb6be05c8949a0bc8e6b9cd8
      
https://github.com/qemu/qemu/commit/5b28ab8bda41768acb6be05c8949a0bc8e6b9cd8
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: add local Tunlinkat symlink test

This test case uses a Tunlinkat request to remove a symlink using
the 9pfs 'local' fs driver.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: 
<a23cd4d2ab6d8d3048addab8cbf0416fe5ead43e.1603285620.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 64e3d4032296aae1adf80e6638b2c4b1987a70d0
      
https://github.com/qemu/qemu/commit/64e3d4032296aae1adf80e6638b2c4b1987a70d0
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: add local Tlink test

This test case uses a Tlink request to create a hard link to a regular
file using the 9pfs 'local' fs driver.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: 
<f0d869770ad23ee5ce10f7da90fdb742cadcad72.1603285620.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: 4d0746e2135f56c59c6e61ef42d700b7139065b4
      
https://github.com/qemu/qemu/commit/4d0746e2135f56c59c6e61ef42d700b7139065b4
  Author: Christian Schoenebeck <qemu_oss@crudebyte.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  tests/9pfs: add local Tunlinkat hard link test

This test case uses a Tunlinkat request to remove a previously hard
linked file by using the 9pfs 'local' fs driver.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: 
<9bec33a7d8f006ef8f80517985d0d6ac48650d53.1603285620.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>


  Commit: b149dea55cce97cb226683d06af61984a1c11e96
      
https://github.com/qemu/qemu/commit/b149dea55cce97cb226683d06af61984a1c11e96
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2020-11-02 (Mon, 02 Nov 2020)

  Changed paths:
    M tests/qtest/libqos/virtio-9p.c
    M tests/qtest/libqos/virtio-9p.h
    M tests/qtest/virtio-9p-test.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/cschoenebeck/tags/pull-9p-20201102' 
into staging

9pfs: only test case changes this time

* Fix occasional test failures with parallel tests.

* Fix coverity error in test code.

* Avoid error when auto removing test directory if it disappeared
  for some reason.

* Refactor: Rename functions to make top-level test functions fs_*()
  easily distinguishable from utility test functions do_*().

* Refactor: Drop unnecessary function arguments in utility test
  functions.

* More test cases using the 9pfs 'local' filesystem driver backend,
  namely for the following 9p requests: Tunlinkat, Tlcreate, Tsymlink
  and Tlink.

# gpg: Signature made Mon 02 Nov 2020 09:31:35 GMT
# gpg:                using RSA key 96D8D110CF7AF8084F88590134C2B58765A47395
# gpg:                issuer "qemu_oss@crudebyte.com"
# gpg: Good signature from "Christian Schoenebeck <qemu_oss@crudebyte.com>" 
[unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: ECAB 1A45 4014 1413 BA38  4926 30DB 47C3 A012 D5F4
#      Subkey fingerprint: 96D8 D110 CF7A F808 4F88  5901 34C2 B587 65A4 7395

* remotes/cschoenebeck/tags/pull-9p-20201102:
  tests/9pfs: add local Tunlinkat hard link test
  tests/9pfs: add local Tlink test
  tests/9pfs: add local Tunlinkat symlink test
  tests/9pfs: add local Tsymlink test
  tests/9pfs: add local Tunlinkat file test
  tests/9pfs: add local Tlcreate test
  tests/9pfs: add local Tunlinkat directory test
  tests/9pfs: simplify do_mkdir()
  tests/9pfs: Turn fs_mkdir() into a helper
  tests/9pfs: Turn fs_readdir_split() into a helper
  tests/9pfs: Factor out do_attach() helper
  tests/9pfs: Set alloc in fs_create_dir()
  tests/9pfs: Factor out do_version() helper
  tests/9pfs: Force removing of local 9pfs test directory
  tests/9pfs: fix coverity error in create_local_test_dir()
  tests/9pfs: fix test dir for parallel tests
  tests/9pfs: make create/remove test dir public

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/2c6605389c1f...b149dea55cce



reply via email to

[Prev in Thread] Current Thread [Next in Thread]