v2 (by azat):
- drop package installations
- use local .abi-check over $HOME/abi-check for build dir
- drop regex check, simply use default values (too complex otherwise)
- use sub-shell to avoid cd back
- add missing quotes
- make the style uniq across the whole file (no tabs for indent, copy-paste?)
- drop `set -x`, use `bash -x abi-check.sh` over
- drop EVENT_ABI_CHECK
- use /usr/bin/env bash as shebang
- use `find | xargs` over `cp $(grep -v)`
- adjust markdown syntax in abi-check/README.md
- adjust link to the publicly available documentation
v3 (by azat):
- docker image
- git check-ignore
- make -j8
- allow to change defaults
Refs: #887
Should fix the following current failures:
- 2020-05-04T22:32:02.9490248Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(231,5): error MSB6006: "cmd.exe" exited with code 3. [D:\a\libevent\libevent\build\regress.vcxproj]
- cmake : /usr/bin/sh: /C/hostedtoolcache/windows/Python/3.7.6/x64/python.exe: No such file or directory
P.S. I guess python has another path, but on my fork it is the same and
it passes.
- EV_CLOSED is EPOLLRDHUP in epoll
- EPOLLRDHUP reported w/o EPOLLHUP if the socket closed with shutdown(SHUT_WR)
- EPOLLRDHUP reported w/ EPOLLHUP if the socket closed with close()
so in this case epoll backend will detect this event as error
(EV_READ|EV_WRITE), since the epoll_ctl() will return EPOLLRDHUP with
EPOLLHUP set, but this is not correct, let's fix this.
Fixes: #984
* EV_CLOSED-and-EV_ET-fixes:
Avoid triggering wrong events with EV_ET set
epoll: handle EV_ET for EV_CLOSED too
test: cover EV_CLOSED with lots of possible scenarious
test: rename simpleclose to simpleclose_rw (since it works via write/read)
For the event at least something except EV_ET should be set, so checking
ev->ev_events with "triggered" events is wrong, because EV_ET is always
passed (see epoll), since it will be filtered out if it is not set in
event.
* event_rpcgen.py-cleanup:
event_rpcgen.py: fix arguments-differ
event_rpcgen.py: fix attribute-defined-outside-init
event_rpcgen: suppress some warnings to make pylint clean
Don't accumulate arguments in `Entry.GetTranslation`
Fix improper string concatenations in lists
Fix warnings regarding unused variables
Don't override the `type` built-in
Call `super` to call methods from the parent class
Address `no-self-use` issues reported by pylint
Run the code through the black formatter
Reformat strings to template
Add `argparse` support
Precompile regular expressions
Use bools instead of ints values where possible
Rename all global variables to match the PEP8 spec
Handle file pointers with context suite patterns
Iterate over `tokens` with a for instead of while
Fix indentation for `RpcGenError`
Don't override `file` built-in
Resolve variable name issues per PEP8
Sort imports per PEP8
Initialize `extradict` safely to avoid accumulating arguments in dict
objects passed in across calls.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This change adds commas between elements or explicitly concatenates the
strings, so the values are no longer concatenated by accident.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Not only does it make it clearer to the reader what the intent is behind
the code, it fixes MRO evaluation of classes if the parent-child
relationship is nonlinear.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Sprinkle around `@staticmethod` where need be and raise
`NotImplementedError` from `Entry.GetInitializer` instead of doing
similar with `assert`. `NotImplementedError` will provide a hint to
static analyzers that there are abstract methods which need to be
implemented, if they aren't, in subclasses.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This resolves a number of flake8 issues as well as pylint issues. Not
all of the changes mesh between flake8/pylint though, so there are some
false positives, but it's better than before.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This change converts the existing code to use triple-quotes extensively,
in the end-goal of making the code to reformat with black more readable
before and after the change (black messes around with the formatting in
a less than desirable way).
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This change converts raw parsing with `sys.argv` to its equivalent logic
with `argparse`.
It doesn't fully convert over all of the TODO items listed in the
comments, but it does provide some top-level structure which can be used
to drive down further improvements and structure.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This change boost performance at scale by pre-compiling regular
expressions in the global space, then reusing them many times within
functions.
This (while not the desired intent of the author) will boost
performance when parsing input.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This is being done to clarify logic and isn't being done for performance
reasons whatsoever, as bools are derived from ints.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Global variables should be in all caps, as opposed to lowercase.
While here, use named groups for `STRUCT_REF_RE` instead of numbered
groups to make the results and their indented tokens to parse more
intuitive to the end reader.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Indentation for the exception was double what it should have been. This
change normalizes the indentation to a consistent standard with the rest
of the file.
Fix minor flake8 issues while here corresponding to the minimum number
of needed blank lines around the class and its methods.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Use `filep` instead of `file` to clarify the fact that `file` is a file
pointer object.
This mutes warnings on python 2.7 with `pylint`.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Move all logic under `if __name__ == "__main__"` to a `main(..)`
function.
The purpose of this is to not only address flake8/pylint reported issues
with variable names, but also to enable testing of the function in
isolation to ensure the logic acts as desired.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Move the pragma ignoring outside the function to fix the build with gcc.
While here, add equivalent clang pragmas to mute the warning, as well.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
* upstream/pr/976:
github workflows: ignore previous cache
github workflows: test for mingw via cmake
cmake: replace CheckFunctionExists with CheckSymbolExists
Checking functions with `CheckFunctionExists` may
get wrong results, we should replace it with
`CheckSymbolExists`, which is recommended by the cmake
official documentation.
Before using `CheckSymbolExists`, we use
`CheckIncludeFiles` to check header files and save the
available header files in a variable that guarantees
`CheckSymbolExists` and `CheckTypeSize` to work correctly.
This approach is modeled after the cmake scripts of `curl`.
The following functions or files were not found before
modification, they can now be found:
- msys2 + mingw-8.1.0 on Windows10 or mingw-7.3.0 on Ubuntu-18.04
timerclear
timercmp
timerisset
- windows10
getaddrinfo
getnameinfo
getprotobynumber
getservbyname
putenv
strtoll
timerclear
timercmp
timerisset
- ubuntu-18.04
sys/sysctl.h
timeradd
timerclear
timercmp
timerisset
- MacOS 10.13
sys/random.h
timeradd
timerclear
timercmp
timerisset
The current cmake/LibeventConfig.cmake.in has a few problems and I'm not
sure how cleanly developed it is. It seems rater complex for the little
things I would assume it needs to do.
I found two problems that are fixed in this PR:
- If the downstream user does not explicitly set LIBEVENT_STATIC_LINK
before calling find_package(libevent) then they will not be able to
detect the static library, even if its the only one that exists. Since
this may be rather strict, I've changed the behavior so that
LIBEVENT_STATIC_LINK can be set to ON or OFF, but if unset, it defaults
to whatever configuration libevent was built as.
- The other problem is a bug. The package configuration needs to unset
CMAKE_FIND_LIBRARY_SUFFIXES after use, otherwise all packages that are
detected after libevent will be "infected" by this setting. This was a
significant problem for us, and is very hard to detect in downstream
project, because the order of dependencies will lead to different search
results.