Compare commits
No commits in common. "c8" and "c9s" have entirely different histories.
|
@ -1,2 +1,48 @@
|
|||
SOURCES/tevent-0.16.0.tar.gz
|
||||
SOURCES/tevent.keyring
|
||||
tevent-0.9.8.tar.gz
|
||||
/tevent-0.9.10.tar.gz
|
||||
/tevent-0.9.11.tar.gz
|
||||
/tevent-0.9.13.tar.gz
|
||||
/tevent-0.9.14.tar.gz
|
||||
/tevent-0.9.15.tar.gz
|
||||
/tevent-0.9.16.tar.gz
|
||||
/tevent-0.9.17.tar.gz
|
||||
/tevent-0.9.18.tar.gz
|
||||
/tevent-0.9.19.tar.gz
|
||||
/tevent-0.9.20.tar.gz
|
||||
/tevent-0.9.21.tar.gz
|
||||
/tevent-0.9.22.tar.gz
|
||||
/tevent-0.9.23.tar.gz
|
||||
/tevent-0.9.24.tar.gz
|
||||
/tevent-0.9.25.tar.gz
|
||||
/tevent-0.9.26.tar.gz
|
||||
/tevent-0.9.28.tar.gz
|
||||
/tevent-0.9.29.tar.gz
|
||||
/tevent-0.9.30.tar.gz
|
||||
/tevent-0.9.31.tar.gz
|
||||
/tevent-0.9.32.tar.gz
|
||||
/tevent-0.9.33.tar.gz
|
||||
/tevent-0.9.34.tar.gz
|
||||
/tevent-0.9.35.tar.gz
|
||||
/tevent-0.9.36.tar.gz
|
||||
/tevent-0.9.37.tar.gz
|
||||
/tevent-0.9.38.tar.gz
|
||||
/tevent-0.9.39.tar.gz
|
||||
/tevent-0.10.0.tar.gz
|
||||
/tevent-0.10.1.tar.gz
|
||||
/tevent-0.10.2.tar.gz
|
||||
/tevent-0.10.1.tar.asc
|
||||
/tevent-0.10.2.tar.asc
|
||||
/tevent-0.11.0.tar.gz
|
||||
/tevent-0.11.0.tar.asc
|
||||
/tevent-0.12.0.tar.asc
|
||||
/tevent-0.12.0.tar.gz
|
||||
/tevent-0.12.1.tar.gz
|
||||
/tevent-0.12.1.tar.asc
|
||||
/tevent-0.13.0.tar.gz
|
||||
/tevent-0.13.0.tar.asc
|
||||
/tevent-0.14.1.tar.asc
|
||||
/tevent-0.14.1.tar.gz
|
||||
/tevent-0.16.0.tar.gz
|
||||
/tevent-0.16.0.tar.asc
|
||||
/tevent-0.16.1.tar.asc
|
||||
/tevent-0.16.1.tar.gz
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
2ff73e579c804a5647c4e871d2b464de499c744e tevent-0.16.1.tar.asc
|
||||
d3fcaccc8804427d6d6c29e40b00e3568cc01f36 tevent-0.16.1.tar.gz
|
|
@ -1,11 +0,0 @@
|
|||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQEzBAABCgAdFiEEkUejOXGVGO6QEby1R5ORYRMIQCUFAmUs8V4ACgkQR5ORYRMI
|
||||
QCWl4gf+NmjfvovCjcT8chpjSQakKh8TjS5Shb0Z9HN6VFGsFovDtyiChx4CjmrK
|
||||
iHdVuS7PdeAcXOo6Y0nlpFcYl4Yo0MJWe+xrUIpT7OSq4jQW50pBv77QMEmCPSew
|
||||
LJY/SMuMDCIlsD6BWfVav3SU2w0CL6iSBT4db1x+HDr8yjmZf40N8SaIu94NjSpE
|
||||
ayKXlQxHiq8yT11fAg/MFl5RyCXHixgw7Ylzm7zGYxQB5ftUUaqCXgJcefBil1xs
|
||||
fhChO+t2Rpb81fBhpgofLv1gcdUraBORfFHJLzOE+XSMnS229k88LyBsGOja9gpK
|
||||
TvrMY9lzEwZXKvTwupFa74mKb7I0ng==
|
||||
=863s
|
||||
-----END PGP SIGNATURE-----
|
|
@ -0,0 +1,6 @@
|
|||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-9
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
|
@ -1,14 +1,8 @@
|
|||
%if 0%{?fedora} || 0%{?rhel} > 7
|
||||
%bcond_without python3
|
||||
%else
|
||||
%bcond_with python3
|
||||
%endif
|
||||
|
||||
%global talloc_version 2.4.1
|
||||
%global talloc_version 2.4.2
|
||||
|
||||
Name: libtevent
|
||||
Version: 0.16.0
|
||||
Release: 0%{?dist}
|
||||
Version: 0.16.1
|
||||
Release: 1%{?dist}
|
||||
Summary: The tevent library
|
||||
License: LGPL-3.0-or-later
|
||||
URL: http://tevent.samba.org/
|
||||
|
@ -27,11 +21,8 @@ BuildRequires: libcmocka-devel >= 1.1.3
|
|||
BuildRequires: libtalloc-devel >= %{talloc_version}
|
||||
BuildRequires: libxslt
|
||||
BuildRequires: make
|
||||
%if %{with python3}
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-talloc-devel >= %{talloc_version}
|
||||
#endif with python
|
||||
%endif
|
||||
|
||||
Provides: bundled(libreplace)
|
||||
Obsoletes: python2-tevent < 0.10.0-1
|
||||
|
@ -52,7 +43,6 @@ Requires: libtalloc-devel%{?_isa} >= %{talloc_version}
|
|||
Header files needed to develop programs that link against the Tevent library.
|
||||
|
||||
|
||||
%if %{with python3}
|
||||
%package -n python3-tevent
|
||||
Summary: Python 3 bindings for the Tevent library
|
||||
Requires: libtevent%{?_isa} = %{version}-%{release}
|
||||
|
@ -61,8 +51,6 @@ Requires: libtevent%{?_isa} = %{version}-%{release}
|
|||
|
||||
%description -n python3-tevent
|
||||
Python 3 bindings for libtevent
|
||||
#endif with python
|
||||
%endif
|
||||
|
||||
%prep
|
||||
zcat %{SOURCE0} | gpgv2 --quiet --keyring %{SOURCE2} %{SOURCE1} -
|
||||
|
@ -97,60 +85,113 @@ cp -a doc/man/man3 %{buildroot}%{_mandir}
|
|||
%{_libdir}/pkgconfig/tevent.pc
|
||||
%{_mandir}/man3/tevent*.gz
|
||||
|
||||
%if %{with python3}
|
||||
%files -n python3-tevent
|
||||
%{python3_sitearch}/tevent.py
|
||||
%{python3_sitearch}/__pycache__/tevent.*
|
||||
%{python3_sitearch}/_tevent.cpython*.so
|
||||
%endif
|
||||
|
||||
%ldconfig_scriptlets
|
||||
|
||||
%changelog
|
||||
* Fri Nov 17 2023 Pavel Filipenský <pfilipen@redhat.com> - 0.16.0-0
|
||||
- resolves: RHEL-16504 - update to version 0.16.0
|
||||
* Thu Apr 25 2024 Pavel Filipenský <pfilipen@redhat.com> - 0.16.1-1
|
||||
- resolves: RHEL-33755 - Rebase to version 0.16.1
|
||||
|
||||
* Tue Jun 06 2023 Pavel Filipenský <pfilipen@redhat.com> - 0.14.1-3
|
||||
- resolves: rhbz#2190425 - Rebuild to trigger distrobaker sync
|
||||
* Mon Dec 04 2023 Andreas Schneider <asn@redhat.com> - 0.16.0-1
|
||||
- resolves: RHEL-16481 - Rebase to version 0.16.0
|
||||
|
||||
* Wed May 24 2023 Pavel Filipenský <pfilipen@redhat.com> - 0.14.1-2
|
||||
- resolves: rhbz#2190425 - Add missing tests to fix osci.brew-build.tier0.functional
|
||||
* Mon Jun 05 2023 Pavel Filipenský <pfilipen@redhat.com> - 0.14.1-2
|
||||
- resolves: rhbz#2190424 - Rebuilt to retrigger brew build
|
||||
|
||||
* Thu May 18 2023 Pavel Filipenský <pfilipen@redhat.com> - 0.14.1-1
|
||||
- resolves: rhbz#2190425 Update to version 0.14.1
|
||||
* Wed May 17 2023 Pavel Filipenský <pfilipen@redhat.com> - 0.14.1-1
|
||||
- resolves: rhbz#2190424 - Update to version 0.14.1
|
||||
|
||||
* Mon Oct 24 2022 Andreas Schneider <asn@redhat.com> - 0.13.0-1
|
||||
- resolves: rhbz#2132055 - Update to version 0.13.0
|
||||
* Fri Oct 21 2022 Andreas Schneider <asn@redhat.com> - 0.13.0-1
|
||||
- related: rhbz#2131999 - Update to version 0.13.0
|
||||
|
||||
* Fri Oct 21 2022 Andreas Schneider <asn@redhat.com> - 0.12.1-1
|
||||
- resolves: rhbz#2131999 - Update to version 0.12.1
|
||||
|
||||
* Mon May 02 2022 Pavel Filipenský <pfilipen@redhat.com> - 0.12.0-0
|
||||
- resolves: rhbz#2077485 - Update to version 0.12.0
|
||||
- resolves: rhbz#2077491 - Update to version 0.12.0
|
||||
|
||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 0.11.0-1
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
|
||||
* Fri Jul 09 2021 Andreas Schneider <asn@redhat.com> - 0.11.0-0
|
||||
- resolves: rhbz#1980346 - Update to version 0.11.0
|
||||
- resolves: rhbz#1980694 - Update to version 0.11.0
|
||||
|
||||
* Tue Jun 2 2020 Isaac Boukris <iboukris@redhat.com> - 0.10.2-2
|
||||
- Resolves: #1817563 - Upgrade tevent to 0.10.2 version for samba
|
||||
* Tue Jun 01 2021 Andreas Schneider <asn@redhat.com> - 0.10.2-9
|
||||
- related: rhbz#1962801 - Rebuilt for running gating tests
|
||||
|
||||
* Tue Nov 26 2019 Isaac Boukris <iboukris@redhat.com> - 0.10.0-2
|
||||
- Resolves: #1754421 - Upgrade tevent to 0.10.0 version for samba
|
||||
- Related: #1754421 - Fix sssd tests (tevent)
|
||||
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.10.2-8
|
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||
|
||||
* Tue Apr 30 2019 Jakub Hrozek <jhrozek@redhat.com>
|
||||
- Remove the python2 subpackages on upgrade
|
||||
- Resolves: #1567139 - libtevent: Drop Python 2 subpackage from RHEL 8
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.2-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Wed Apr 24 2019 Jakub Hrozek <jhrozek@redhat.com> - 0.9.39-1
|
||||
- Resolves: #1684580 - Rebase libtevent to version 0.9.36 for Samba
|
||||
- Resolves: #1597318 - libtevent uses Python 2 to build
|
||||
- Resolves: #1567139 - libtevent: Drop Python 2 subpackage from RHEL 8
|
||||
* Thu Oct 22 2020 Andreas Schneider <asn@redhat.com> - 0.10.2-6
|
||||
- Spec file cleanup and improvements
|
||||
|
||||
* Thu Sep 20 2018 Jakub Hrozek <jhrozek@redhat.com> - 0.9.37-2
|
||||
- Resolves: #1624138 - Review annocheck distro flag failures in libtevent
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.2-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 0.10.2-4
|
||||
- Use make macros
|
||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
|
||||
|
||||
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.10.2-3
|
||||
- Rebuilt for Python 3.9
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Wed Jan 22 2020 Lukas Slebodnik <lslebodn@fedoraproject.org> - 0.10.2-1
|
||||
- rhbz#1749005 - libtevent-0.10.2 is available
|
||||
|
||||
* Wed Sep 11 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 0.10.1-1
|
||||
- rhbz#1749005 - libtevent-0.10.1 is available
|
||||
|
||||
* Mon Aug 26 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 0.10.0-1
|
||||
- rhbz#1691300 - libtevent-0.10.0 is available
|
||||
- rhbz#1737644 - libldb, libtalloc, libtevent, libtdb: Remove Python 2 subpackages from Fedora 31+
|
||||
|
||||
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.9.39-5
|
||||
- Rebuilt for Python 3.8
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.39-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Fri Jun 14 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 0.9.39-3
|
||||
- rhbz#1718113 - samba fail to build with Python 3.8
|
||||
AttributeError: module 'time' has no attribute 'clock'
|
||||
|
||||
* Mon Jun 03 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 0.9.39-2
|
||||
- rhbz#1711638 - fails to build with Python 3.8.0a4
|
||||
|
||||
* Tue Feb 26 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 0.9.39-1
|
||||
- rhbz#1683186 - New upstream release 0.9.39
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.38-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Thu Jan 17 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 0.9.38-1
|
||||
- New upstream release 0.9.38
|
||||
|
||||
* Fri Jul 13 2018 Jakub Hrozek <jhrozek@redhat.com> - 0.9.37-2
|
||||
- Drop the unneeded ABI hide patch
|
||||
|
||||
* Thu Jul 12 2018 Jakub Hrozek <jhrozek@redhat.com> - 0.9.37-1
|
||||
- New upstream release 0.9.37
|
||||
- Use RHEL_ALLOW_PYTHON2_FOR_BUILD=1 for build
|
||||
- Use %%{__python2}, not "python", as the Python2 interpreter
|
||||
- Apply a patch to hide local ABI symbols to avoid issues with new binutils
|
||||
- Patch the waf script to explicitly call python2 as "env python" doesn't
|
||||
yield py2 anymore
|
||||
|
||||
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.9.36-3
|
||||
- Rebuilt for Python 3.7
|
||||
|
||||
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.9.36-2
|
||||
- Rebuilt for Python 3.7
|
||||
|
||||
* Mon Feb 26 2018 Lukas Slebodnik <lslebodn@fedoraproject.org> - 0.9.36-1
|
||||
- rhbz#1548613 New upstream release 0.9.36
|
|
@ -0,0 +1,2 @@
|
|||
SHA512 (tevent-0.16.1.tar.asc) = 9388ba46cc1fa1fded730a119b67f91701b5585863b04428b3e2429fe1c3c096883eda739cf88581e881e03b7eba2d71ae13bdd4e69a9efce1e066330ea0afa1
|
||||
SHA512 (tevent-0.16.1.tar.gz) = cda001d91728b2f28dd081e9c5f6d8ede345dcd9ce1dca04394860cd83090c15aa8dfef1c53b73e120bd17f0d95551fa9301eb4927963314556d016fe5420a39
|
|
@ -0,0 +1,46 @@
|
|||
# SPDX-License-Identifier: LGPL-2.1+
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /CoreOS/libtevent
|
||||
# Description: Test if libtevent working ok
|
||||
# Author: Susant Sahani<susant@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export TEST=/CoreOS/libtevent
|
||||
export TESTVERSION=1.0
|
||||
|
||||
OBJS = test-libtevent.c
|
||||
CFLAG = -Wall -g3
|
||||
CC = gcc
|
||||
LIBS = -ltevent -ltalloc -lpthread
|
||||
|
||||
test-libtevent:${OBJ}
|
||||
${CC} ${CFLAGS} ${INCLUDES} -o $@ ${OBJS} ${LIBS}
|
||||
|
||||
run: test-libtevent
|
||||
./runtest.sh
|
||||
clean:
|
||||
-rm -f *~ test-libtevent
|
||||
|
||||
.c.o:
|
||||
${CC} ${CFLAGS} ${INCLUDES} -c $<
|
||||
|
||||
CC = gcc
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Susant Sahani<susant@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: Test libtevent works ok" >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 5m" >> $(METADATA)
|
||||
@echo "RunFor: libtevent" >> $(METADATA)
|
||||
@echo "Requires: libtevent libtevent-devel" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
@echo "Releases: -RedHat Linux 8" >> $(METADATA)
|
||||
rhts-lint $(METADATA)
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: LGPL-2.1+
|
||||
# ~~~
|
||||
# runtest.sh of libtevent
|
||||
# Description: Tests for libtevent
|
||||
#
|
||||
# Author: Susant Sahani <susant@redhat.com>
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
# ~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="libtevent"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm $PACKAGE
|
||||
rlRun "cp test-libtevent /usr/bin/"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlLog "Starting libtevent tests ..."
|
||||
rlRun "/usr/bin/test-libtevent"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "rm /usr/bin/test-libtevent"
|
||||
rlLog "libtevent tests done"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
|
||||
rlGetTestState
|
|
@ -0,0 +1,207 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <tevent.h>
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
#include <assert.h>
|
||||
#include <pthread.h>
|
||||
|
||||
struct state {
|
||||
struct timeval endtime;
|
||||
int counter;
|
||||
TALLOC_CTX *ctx;
|
||||
};
|
||||
|
||||
struct info_struct {
|
||||
int counter;
|
||||
};
|
||||
|
||||
static void callback(struct tevent_context *ev, struct tevent_timer *tim,
|
||||
struct timeval current_time, void *private_data) {
|
||||
struct state *data = talloc_get_type_abort(private_data, struct state);
|
||||
struct tevent_timer *time_event;
|
||||
struct timeval schedule;
|
||||
|
||||
data->counter += 1;
|
||||
|
||||
if (tevent_timeval_compare(¤t_time, &(data->endtime)) < 0) {
|
||||
|
||||
schedule = tevent_timeval_current_ofs(1, 0);
|
||||
time_event = tevent_add_timer(ev, data->ctx, schedule, callback, data);
|
||||
assert(time_event);
|
||||
}
|
||||
}
|
||||
|
||||
int test_tevent_timer(void) {
|
||||
struct tevent_context *event_ctx;
|
||||
struct tevent_timer *time_event;
|
||||
struct timeval schedule;
|
||||
struct state *data;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
|
||||
assert((mem_ctx = talloc_new(NULL)));
|
||||
assert((event_ctx = tevent_context_init(mem_ctx)));
|
||||
|
||||
assert((data = talloc(mem_ctx, struct state)));
|
||||
|
||||
schedule = tevent_timeval_current_ofs(1, 0);
|
||||
data->endtime = tevent_timeval_add(&schedule, 2, 0);
|
||||
data->ctx = mem_ctx;
|
||||
data->counter = 0;
|
||||
|
||||
time_event = tevent_add_timer(event_ctx, mem_ctx, schedule, callback, data);
|
||||
tevent_loop_wait(event_ctx);
|
||||
|
||||
assert(data->counter == 3);
|
||||
talloc_free(mem_ctx);
|
||||
}
|
||||
|
||||
static void foo(struct tevent_context *ev, struct tevent_immediate *im, void *private_data) {
|
||||
struct info_struct *data = talloc_get_type_abort(private_data, struct info_struct);
|
||||
|
||||
data->counter++;
|
||||
}
|
||||
|
||||
int test_tevent_immediate(void) {
|
||||
struct tevent_context *event_ctx;
|
||||
struct tevent_immediate *im;
|
||||
struct info_struct *data;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
|
||||
assert((mem_ctx = talloc_new(NULL)));
|
||||
|
||||
event_ctx = tevent_context_init(mem_ctx);
|
||||
|
||||
assert((data = talloc(mem_ctx, struct info_struct)));
|
||||
data->counter = 0;
|
||||
|
||||
assert((im = tevent_create_immediate(mem_ctx)));
|
||||
|
||||
tevent_schedule_immediate(im, event_ctx, foo, data);
|
||||
tevent_loop_wait(event_ctx);
|
||||
|
||||
assert(data->counter == 1);
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int signal_data;
|
||||
|
||||
static void handler(struct tevent_context *ev, struct tevent_signal *se, int signum, int count, void *siginfo, void *private_data) {
|
||||
signal_data = 1;
|
||||
}
|
||||
|
||||
int test_tevent_signal(void) {
|
||||
struct tevent_context *event_ctx;
|
||||
struct tevent_signal *sig;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
|
||||
mem_ctx = talloc_new(NULL);
|
||||
assert(mem_ctx);
|
||||
|
||||
event_ctx = tevent_context_init(mem_ctx);
|
||||
assert(event_ctx);
|
||||
|
||||
if (tevent_signal_support(event_ctx)) {
|
||||
sig = tevent_add_signal(event_ctx, mem_ctx, SIGINT, 0, handler, NULL);
|
||||
assert(sig);
|
||||
tevent_loop_once(event_ctx);
|
||||
}
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
}
|
||||
|
||||
struct foo_state {
|
||||
int x;
|
||||
};
|
||||
|
||||
struct testA {
|
||||
int y;
|
||||
};
|
||||
|
||||
static void foo_done(struct tevent_req *req) {
|
||||
struct foo_state *a = tevent_req_data(req, struct foo_state);
|
||||
struct testA *b = tevent_req_callback_data(req, struct testA);
|
||||
struct testA *c = (struct testA *) tevent_req_callback_data_void(req);
|
||||
|
||||
assert(a->x == 10);
|
||||
assert(b->y == 9);
|
||||
assert(c->y == 9);
|
||||
|
||||
printf("a->x: %d\n", a->x);
|
||||
printf("b->y: %d\n", b->y);
|
||||
printf("c->y: %d\n", c->y);
|
||||
}
|
||||
|
||||
struct tevent_req * foo_send(TALLOC_CTX *mem_ctx, struct tevent_context *event_ctx) {
|
||||
struct tevent_req *req;
|
||||
struct foo_state *state;
|
||||
|
||||
printf("_send\n");
|
||||
|
||||
req = tevent_req_create(event_ctx, &state, struct foo_state);
|
||||
state->x = 10;
|
||||
return req;
|
||||
}
|
||||
|
||||
static void run(struct tevent_context *ev, struct tevent_timer *te,
|
||||
struct timeval current_time, void *private_data) {
|
||||
struct tevent_req *req;
|
||||
struct testA *tmp = talloc(ev, struct testA);
|
||||
|
||||
tmp->y = 9;
|
||||
req = foo_send(ev, ev);
|
||||
tevent_req_set_callback(req, foo_done, tmp);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
|
||||
int test_event_data(void) {
|
||||
struct tevent_context *event_ctx;
|
||||
struct tevent_timer *time_event;
|
||||
struct testA *data;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
|
||||
mem_ctx = talloc_new(NULL);
|
||||
assert(mem_ctx);
|
||||
|
||||
event_ctx = tevent_context_init(mem_ctx);
|
||||
assert(event_ctx);
|
||||
|
||||
data = talloc(mem_ctx, struct testA);
|
||||
data->y = 11;
|
||||
time_event = tevent_add_timer(event_ctx,
|
||||
mem_ctx,
|
||||
tevent_timeval_current(),
|
||||
run,
|
||||
data);
|
||||
assert(time_event);
|
||||
|
||||
tevent_loop_once(event_ctx);
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
pid_t pid, ppid;
|
||||
int r;
|
||||
|
||||
test_tevent_timer();
|
||||
test_tevent_immediate();
|
||||
|
||||
/* signal test */
|
||||
ppid = getpid();
|
||||
if((pid = fork()) == 0) {
|
||||
sleep(1);
|
||||
kill(ppid, SIGINT);
|
||||
exit(0);
|
||||
} else {
|
||||
test_tevent_signal();
|
||||
}
|
||||
assert(signal_data == 1);
|
||||
|
||||
test_event_data();
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
- hosts: localhost
|
||||
roles:
|
||||
- role: standard-test-beakerlib
|
||||
tags:
|
||||
- classic
|
||||
tests:
|
||||
- sanity-tests
|
||||
required_packages:
|
||||
- libtevent
|
||||
- libtevent-devel
|
||||
- glibc
|
||||
- gcc
|
Binary file not shown.
Loading…
Reference in New Issue