aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/fdc-test.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2022-09-28 17:04:11 -0400
committerStefan Hajnoczi <stefanha@redhat.com>2022-09-28 17:04:11 -0400
commitc8de6ec63d766ca1998c5af468483ce912fdc0c2 (patch)
treea52db66c3f796445b2923ac2d752d497baebab6b /tests/qtest/fdc-test.c
parent36cd0aeac3337af06875e08683380389df48ccd0 (diff)
parent0b49bc1b713d6e3896179f9700c8c35e511075f6 (diff)
Merge tag 'pull-request-2022-09-28' of https://gitlab.com/thuth/qemu into staging
* Fixes for qtests and unit tests to be more portable to non-POSIX platforms # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmMz9MQRHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbVUKRAAnubo/wtHqjxg/yVO68odX2LFI2koligA # LcEAnhGkVJ/Pe/+Qo9yVbcOY6k6xfGQU3VIipqvLEwPAdSF0E43EJxlImBNm8/Zq # MggjNoepXRhdFGULONSmSNm7HJykLH/CHdmBjPLrbpkTCwWG1gg64xP9fI+b8mGf # vST0ADuYloLDA9J45UbC33AD+9dQsy2GeOs8X99O6ysKF3htEqMD3vBdqKiJSwgT # 2c7UqySGECn6kMHl7iAdipRNUghSgzpUe8LcH4jP7Y1XnoB3zwC/+VrOVwFESI6y # LVFsC8u7cEKKSYunoowfQTgHvYbCuSdrDqljy17NE5qRMziKMTnhXaQNR5wtBKNt # HZxvc082P/QDFdBYYY3MIjB27r/I6x0t6Xl4IVwLz7bK0xfHFF8Ba2Lr57/2RTc/ # SMPDxGrMicTPnPDU/Cw5VROMmw0OC/tVpJMGo1VjVnNESo581RAMApyzkWiUyfZj # ktKd+4ihmqrBXcZHVjKbIufa6eKNuktlkfv72dnJY4XoUlDHlbDYaVuknybZmxWK # 9/CDVDG72s5Cqm+M47Q56IagVVZwIGrUP0u3j3h/v0rnHZehY8Qzr3SLEfeqmUb6 # nP7MP+ItZFZtMITdvXb3OtyeVuM0ZSw8kt+/evpvC9zB6FjgYl/e5FppsO0HxB/O # PeeV43Bk270= # =n+FM # -----END PGP SIGNATURE----- # gpg: Signature made Wed 28 Sep 2022 03:16:20 EDT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * tag 'pull-request-2022-09-28' of https://gitlab.com/thuth/qemu: (37 commits) docs/devel: testing: Document writing portable test cases tests/qtest: boot-serial-test: Close the serial file before starting QEMU tests/qtest: vhost-user-test: Avoid using hardcoded /tmp tests/qtest: qmp-test: Avoid using hardcoded /tmp tests/qtest: pflash-cfi02-test: Avoid using hardcoded /tmp tests/qtest: hd-geo-test: Avoid using hardcoded /tmp tests/x86: Move common code to function in device-plug-test .gitlab-ci.d/windows.yml: Display meson test logs tests/qtest: migration-test: Skip running some TLS cases for win32 tests/qtest: libqtest: Replace the call to close a socket with closesocket() tests/qtest: microbit-test: Fix socket access for win32 tests/qtest: virtio-net-failover: Disable migration tests for win32 tests/qtest: ide-test: Open file in binary mode tests/qtest: migration-test: Disable IO redirection for win32 tests/qtest: bios-tables-test: Adapt the case for win32 tests/qtest: {ahci, ide}-test: Use relative path for temporary files for win32 tests/qtest: libqtest: Exclude the *_fds APIs for win32 tests/qtest: libqtest: Adapt global_qtest declaration for win32 tests/qtest: qmp-test: Skip running test_qmp_oob for win32 tests/qtest: Build test-filter-{mirror, redirector} cases for posix only ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/qtest/fdc-test.c')
-rw-r--r--tests/qtest/fdc-test.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c
index 52ade90a7d..1f9b99ad6d 100644
--- a/tests/qtest/fdc-test.c
+++ b/tests/qtest/fdc-test.c
@@ -68,7 +68,7 @@ enum {
DSKCHG = 0x80,
};
-static char test_image[] = "/tmp/qtest.XXXXXX";
+static char *test_image;
#define assert_bit_set(data, mask) g_assert_cmphex((data) & (mask), ==, (mask))
#define assert_bit_clear(data, mask) g_assert_cmphex((data) & (mask), ==, 0)
@@ -608,7 +608,7 @@ int main(int argc, char **argv)
int ret;
/* Create a temporary raw image */
- fd = mkstemp(test_image);
+ fd = g_file_open_tmp("qtest.XXXXXX", &test_image, NULL);
g_assert(fd >= 0);
ret = ftruncate(fd, TEST_IMAGE_SIZE);
g_assert(ret == 0);
@@ -640,6 +640,7 @@ int main(int argc, char **argv)
/* Cleanup */
qtest_end();
unlink(test_image);
+ g_free(test_image);
return ret;
}