[PATCH v2 18/19] tests/qtest: virtio-9p-test: Adapt the case for win32

Bin Meng posted 19 patches 3 years, 3 months ago
Maintainers: Greg Kurz <groug@kaod.org>, Christian Schoenebeck <qemu_oss@crudebyte.com>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Laurent Vivier <lvivier@redhat.com>
[PATCH v2 18/19] tests/qtest: virtio-9p-test: Adapt the case for win32
Posted by Bin Meng 3 years, 3 months ago
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.

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

---

Changes in v2:
- Move getuid() to virtio-9p-client.h

 tests/qtest/libqos/virtio-9p-client.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/qtest/libqos/virtio-9p-client.h b/tests/qtest/libqos/virtio-9p-client.h
index 78228eb97d..a5c0107580 100644
--- a/tests/qtest/libqos/virtio-9p-client.h
+++ b/tests/qtest/libqos/virtio-9p-client.h
@@ -491,4 +491,11 @@ void v9fs_rlink(P9Req *req);
 TunlinkatRes v9fs_tunlinkat(TunlinkatOpt);
 void v9fs_runlinkat(P9Req *req);
 
+#ifdef CONFIG_WIN32
+static inline uint32_t getuid(void)
+{
+    return 0;
+}
+#endif
+
 #endif
-- 
2.25.1
Re: [PATCH v2 18/19] tests/qtest: virtio-9p-test: Adapt the case for win32
Posted by Thomas Huth 3 years, 3 months ago
On 11/11/2022 05.22, 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.
> 
> Co-developed-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
> Signed-off-by: Guohuai Shi <guohuai.shi@windriver.com>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> 
> ---
> 
> Changes in v2:
> - Move getuid() to virtio-9p-client.h
> 
>   tests/qtest/libqos/virtio-9p-client.h | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/tests/qtest/libqos/virtio-9p-client.h b/tests/qtest/libqos/virtio-9p-client.h
> index 78228eb97d..a5c0107580 100644
> --- a/tests/qtest/libqos/virtio-9p-client.h
> +++ b/tests/qtest/libqos/virtio-9p-client.h
> @@ -491,4 +491,11 @@ void v9fs_rlink(P9Req *req);
>   TunlinkatRes v9fs_tunlinkat(TunlinkatOpt);
>   void v9fs_runlinkat(P9Req *req);
>   
> +#ifdef CONFIG_WIN32
> +static inline uint32_t getuid(void)
> +{
> +    return 0;
> +}
> +#endif
> +
>   #endif

Reviewed-by: Thomas Huth <thuth@redhat.com>