Skip to content

Commit

Permalink
Load bsd.cfg by default in daca (#6009)
Browse files Browse the repository at this point in the history
Moving `timercmp()` to `bsd.cfg` has caused syntax errors in daca
(`error: syntax error: <) [syntaxError]`). Also we don't auto-detect BSD
library usage.
  • Loading branch information
chrchr-github authored Feb 20, 2024
1 parent 648f09f commit 6c0a222
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions tools/donate_cpu_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
# changes)
CLIENT_VERSION = "1.3.54"
CLIENT_VERSION = "1.3.55"

# Timeout for analysis with Cppcheck in seconds
CPPCHECK_TIMEOUT = 30 * 60
Expand Down Expand Up @@ -733,7 +733,7 @@ def __iterate_files(self, path, has_include_cb):

def get_libraries(self, folder):
print('Detecting library usage...')
libraries = ['posix', 'gnu']
libraries = ['posix', 'gnu', 'bsd']

# explicitly copy as assignments in python are references
library_includes_re = copy.copy(self.__library_includes_re)
Expand Down
48 changes: 24 additions & 24 deletions tools/donate_cpu_lib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,32 @@ def _test_library_includes(tmpdir, libs, content, libinc_obj=None):
assert libs == libs_found

def test_library_includes(tmpdir):
_test_library_includes(tmpdir, ['posix', 'gnu'], '')
_test_library_includes(tmpdir, ['posix', 'gnu'], '#include <stdio.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'boost'], '#include <boost/regex.hpp>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'python'], '#include "Python.h"')
_test_library_includes(tmpdir, ['posix', 'gnu', 'libcerror', 'lua', 'opengl', 'qt'], '#include <QApplication>\n#include <GL/gl.h>\r#include "lua.h"\r\n#include <libcerror.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'microsoft_sal'], ' #include <sal.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'googletest'], '\t#include <gtest/gtest.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'microsoft_atl'], ' \t #include <atlbase.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'cairo'], '\t #include <cairo.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'gtk'], ' \t#include <glib-object.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd'], '#include <sys/uio.h>\r\n')
_test_library_includes(tmpdir, ['posix', 'gnu', 'libcurl'], '#include <curl/curl.h>\r')
_test_library_includes(tmpdir, ['posix', 'gnu', 'sqlite3'], '#include <sqlite3.h>\n')
_test_library_includes(tmpdir, ['posix', 'gnu', 'openmp'], '# include <omp.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'mfc'], '#\tinclude <afxwin.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'ruby'], '# \tinclude "ruby.h"')
_test_library_includes(tmpdir, ['posix', 'gnu', 'zlib'], '#\t include <zlib.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'pcre'], '#include<pcre.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'pcre'], '#include "pcre.h"')
_test_library_includes(tmpdir, ['posix', 'gnu', 'opengl'], '#include\t <GL/glut.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'nspr'], '#include\t"prtypes.h"')
_test_library_includes(tmpdir, ['posix', 'gnu', 'lua'], '#include \t<lua.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd'], '')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd'], '#include <stdio.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'boost'], '#include <boost/regex.hpp>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'python'], '#include "Python.h"')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'libcerror', 'lua', 'opengl', 'qt'], '#include <QApplication>\n#include <GL/gl.h>\r#include "lua.h"\r\n#include <libcerror.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'microsoft_sal'], ' #include <sal.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'googletest'], '\t#include <gtest/gtest.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'microsoft_atl'], ' \t #include <atlbase.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'cairo'], '\t #include <cairo.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'gtk'], ' \t#include <glib-object.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'bsd'], '#include <sys/uio.h>\r\n')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'libcurl'], '#include <curl/curl.h>\r')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'sqlite3'], '#include <sqlite3.h>\n')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'openmp'], '# include <omp.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'mfc'], '#\tinclude <afxwin.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'ruby'], '# \tinclude "ruby.h"')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'zlib'], '#\t include <zlib.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'pcre'], '#include<pcre.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'pcre'], '#include "pcre.h"')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'opengl'], '#include\t <GL/glut.h>')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'nspr'], '#include\t"prtypes.h"')
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'lua'], '#include \t<lua.h>')

def test_match_multiple_time(tmpdir):
libinc = LibraryIncludes()

# there was a bug that we would only match each library once successfully
_test_library_includes(tmpdir, ['posix', 'gnu', 'zlib'], '#include <zlib.h>', libinc)
_test_library_includes(tmpdir, ['posix', 'gnu', 'zlib'], '#include <zlib.h>', libinc)
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'zlib'], '#include <zlib.h>', libinc)
_test_library_includes(tmpdir, ['posix', 'gnu', 'bsd', 'zlib'], '#include <zlib.h>', libinc)

0 comments on commit 6c0a222

Please sign in to comment.