From nobody Mon Feb 9 03:46:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1580538962917150.67251297970495; Fri, 31 Jan 2020 22:36:02 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-4nl9NMqHPhKe0JxRnvRxHQ-1; Sat, 01 Feb 2020 01:35:59 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E44611005510; Sat, 1 Feb 2020 06:35:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9D0760BE1; Sat, 1 Feb 2020 06:35:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 70B4018089CF; Sat, 1 Feb 2020 06:35:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0116Xu8m012465 for ; Sat, 1 Feb 2020 01:33:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 90C7384791; Sat, 1 Feb 2020 06:33:56 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-34.brq.redhat.com [10.40.204.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11C2877932 for ; Sat, 1 Feb 2020 06:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580538961; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=DzIpqdnXIINwAHWOMOwWYnFZZFucA8rUFoiWubWu5Cs=; b=Dd7fRx/SLeY1tA7BbI7z036aLzFLNQ6U7FGZSt29hnozhYl0EohKXyYZhG/DdWJmIqEI58 8QbQYue4qWSsnmy9A6PSf7GJAkEhVGI82oUbuS0BnAA72gWDPpweHHpfbi55qInkdMA51u mr4DgMMdUJsw77PhJb40tEZzIoqsJzg= From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/7] tests: Drop viratomictest Date: Sat, 1 Feb 2020 07:33:44 +0100 Message-Id: <6c54f4a26202430cb940686fa8a585641fb0caf5.1580538782.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 4nl9NMqHPhKe0JxRnvRxHQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In future commits our virAtomic* APIs will be replaced with their GLib variants. Instead of trying to update the test after each commit and eventually removing the test anyway, remove it upfront and save the hassle. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/Makefile.am | 5 -- tests/viratomictest.c | 175 ------------------------------------------ 2 files changed, 180 deletions(-) delete mode 100644 tests/viratomictest.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 19705c6b76..ef49b122cd 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -179,7 +179,6 @@ test_programs =3D virshtest sockettest \ virhostcputest virbuftest \ commandtest seclabeltest \ virhashtest virconftest \ - viratomictest \ utiltest shunloadtest \ virtimetest viruritest virkeyfiletest \ viralloctest \ @@ -1456,10 +1455,6 @@ virhashtest_SOURCES =3D \ virhashtest.c virhashdata.h testutils.h testutils.c virhashtest_LDADD =3D $(LDADDS) =20 -viratomictest_SOURCES =3D \ - viratomictest.c testutils.h testutils.c -viratomictest_LDADD =3D $(LDADDS) - virbitmaptest_SOURCES =3D \ virbitmaptest.c testutils.h testutils.c virbitmaptest_LDADD =3D $(LDADDS) diff --git a/tests/viratomictest.c b/tests/viratomictest.c deleted file mode 100644 index e30df66cd7..0000000000 --- a/tests/viratomictest.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2011-2013 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * . - * - */ - -#include - -#include -#include - -#include "testutils.h" - -#include "viratomic.h" -#include "virrandom.h" -#include "virthread.h" - -static int -testTypes(const void *data G_GNUC_UNUSED) -{ - unsigned int u, u2; - int s, s2; - bool res; - -#define testAssertEq(a, b) \ - if (!(a =3D=3D b)) \ - return -1; - virAtomicIntSet(&u, 5); - u2 =3D virAtomicIntGet(&u); - testAssertEq(u2, 5); - - res =3D virAtomicIntCompareExchange(&u, 6, 7); - if (res) - return -1; - testAssertEq(u, 5); - - testAssertEq(virAtomicIntAdd(&u, 1), 5); - testAssertEq(u, 6); - - testAssertEq(virAtomicIntInc(&u), 6); - testAssertEq(u, 7); - - res =3D virAtomicIntDecAndTest(&u); - if (res) - return -1; - testAssertEq(u, 6); - - u2 =3D virAtomicIntAnd(&u, 5); - testAssertEq(u2, 6); - testAssertEq(u, 4); - - u2 =3D virAtomicIntOr(&u, 8); - testAssertEq(u2, 4); - testAssertEq(u, 12); - - u2 =3D virAtomicIntXor(&u, 4); - testAssertEq(u2, 12); - testAssertEq(u, 8); - - virAtomicIntSet(&s, 5); - s2 =3D virAtomicIntGet(&s); - testAssertEq(s2, 5); - - res =3D virAtomicIntCompareExchange(&s, 6, 7); - if (res) - return -1; - testAssertEq(s, 5); - - virAtomicIntAdd(&s, 1); - testAssertEq(s, 6); - - virAtomicIntInc(&s); - testAssertEq(s, 7); - - res =3D virAtomicIntDecAndTest(&s); - if (res) - return -1; - testAssertEq(s, 6); - - s2 =3D virAtomicIntAnd(&s, 5); - testAssertEq(s2, 6); - testAssertEq(s, 4); - - s2 =3D virAtomicIntOr(&s, 8); - testAssertEq(s2, 4); - testAssertEq(s, 12); - - s2 =3D virAtomicIntXor(&s, 4); - testAssertEq(s2, 12); - testAssertEq(s, 8); - - return 0; -} - -#define THREADS 10 -#define ROUNDS 10000 - -volatile int bucket[THREADS]; -volatile int atomic; - -static void -thread_func(void *data) -{ - int idx =3D (intptr_t)data; - size_t i; - int d; - - for (i =3D 0; i < ROUNDS; i++) { - d =3D virRandomBits(7); - bucket[idx] +=3D d; - virAtomicIntAdd(&atomic, d); -#ifdef WIN32 - SleepEx(0, 0); -#else - sched_yield(); -#endif - } -} - -static int -testThreads(const void *data G_GNUC_UNUSED) -{ - int sum; - size_t i; - virThread threads[THREADS]; - - atomic =3D 0; - for (i =3D 0; i < THREADS; i++) - bucket[i] =3D 0; - - for (i =3D 0; i < THREADS; i++) { - if (virThreadCreate(&(threads[i]), true, thread_func, (void*)(intp= tr_t)i) < 0) - return -1; - } - - for (i =3D 0; i < THREADS; i++) - virThreadJoin(&threads[i]); - - sum =3D 0; - for (i =3D 0; i < THREADS; i++) - sum +=3D bucket[i]; - - if (sum !=3D atomic) - return -1; - - return 0; -} - -static int -mymain(void) -{ - int ret =3D 0; - - if (virTestRun("types", testTypes, NULL) < 0) - ret =3D -1; - if (virTestRun("threads", testThreads, NULL) < 0) - ret =3D -1; - - return ret; -} - -VIR_TEST_MAIN(mymain) --=20 2.24.1