diff mbox series

[15/16] tests/qtest: virtio-9p-test: Adapt the case for win32

Message ID 20221024045759.448014-16-bin.meng@windriver.com (mailing list archive)
State New, archived
Headers show
Series hw/9pfs: Add 9pfs support for Windows | expand

Commit Message

Bin Meng Oct. 24, 2022, 4:57 a.m. UTC
From: Guohuai Shi <guohuai.shi@windriver.com>

Windows does not provide the getuid() API. Let's create a local
one and return a fixed value 0 as the uid for testing.

Signed-off-by: Guohuai Shi <guohuai.shi@windriver.com>
Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 tests/qtest/virtio-9p-test.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Thomas Huth Oct. 25, 2022, 3:55 p.m. UTC | #1
On 24/10/2022 06.57, Bin Meng wrote:
> From: Guohuai Shi <guohuai.shi@windriver.com>
> 
> Windows does not provide the getuid() API. Let's create a local
> one and return a fixed value 0 as the uid for testing.
> 
> Signed-off-by: Guohuai Shi <guohuai.shi@windriver.com>
> Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
> 
>   tests/qtest/virtio-9p-test.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c
> index 25305a4cf7..e81e3e3709 100644
> --- a/tests/qtest/virtio-9p-test.c
> +++ b/tests/qtest/virtio-9p-test.c
> @@ -34,6 +34,13 @@ static uint32_t genfid(void)
>       return fid_generator++;
>   }
>   
> +#ifdef CONFIG_WIN32
> +static uint32_t getuid(void)
> +{
> +    return 0;
> +}
> +#endif
> +
>   /**
>    * Splits the @a in string by @a delim into individual (non empty) strings
>    * and outputs them to @a out. The output array @a out is NULL terminated.

Acked-by: Thomas Huth <thuth@redhat.com>
Christian Schoenebeck Nov. 1, 2022, 3:32 p.m. UTC | #2
On Monday, October 24, 2022 6:57:58 AM CET Bin Meng wrote:
> From: Guohuai Shi <guohuai.shi@windriver.com>
> 
> Windows does not provide the getuid() API. Let's create a local
> one and return a fixed value 0 as the uid for testing.
> 
> Signed-off-by: Guohuai Shi <guohuai.shi@windriver.com>
> Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
> 
>  tests/qtest/virtio-9p-test.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c
> index 25305a4cf7..e81e3e3709 100644
> --- a/tests/qtest/virtio-9p-test.c
> +++ b/tests/qtest/virtio-9p-test.c
> @@ -34,6 +34,13 @@ static uint32_t genfid(void)
>      return fid_generator++;
>  }
>  
> +#ifdef CONFIG_WIN32
> +static uint32_t getuid(void)
> +{
> +    return 0;
> +}
> +#endif
> +

Due to recent 9p tests restructuring changes, same would be needed for new
tests/qtest/libqos/virtio-9p-client.c source file, as it's also calling 
getuid().

>  /**
>   * Splits the @a in string by @a delim into individual (non empty) strings
>   * and outputs them to @a out. The output array @a out is NULL terminated.
>
diff mbox series

Patch

diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c
index 25305a4cf7..e81e3e3709 100644
--- a/tests/qtest/virtio-9p-test.c
+++ b/tests/qtest/virtio-9p-test.c
@@ -34,6 +34,13 @@  static uint32_t genfid(void)
     return fid_generator++;
 }
 
+#ifdef CONFIG_WIN32
+static uint32_t getuid(void)
+{
+    return 0;
+}
+#endif
+
 /**
  * Splits the @a in string by @a delim into individual (non empty) strings
  * and outputs them to @a out. The output array @a out is NULL terminated.