Added dockerfile to run cpychecker in isolation

This commit is contained in:
Daniele Varrazzo 2019-01-21 20:14:58 +00:00
parent 0abf947cd8
commit 6aaecd6563
2 changed files with 46 additions and 7 deletions

View File

@ -195,13 +195,6 @@ static double round(double num)
#define RAISES_NEG #define RAISES_NEG
#endif #endif
#if defined(WITH_CPYCHECKER_NULL_RESULT_SETS_EXCEPTION_ATTRIBUTE)
#define RAISES_NULL \
__attribute__((cpychecker_null_result_sets_exception))
#else
#define RAISES_NULL
#endif
#if defined(WITH_CPYCHECKER_SETS_EXCEPTION_ATTRIBUTE) #if defined(WITH_CPYCHECKER_SETS_EXCEPTION_ATTRIBUTE)
#define RAISES \ #define RAISES \
__attribute__((cpychecker_sets_exception)) __attribute__((cpychecker_sets_exception))
@ -209,6 +202,16 @@ static double round(double num)
#define RAISES #define RAISES
#endif #endif
/* these attributes are available in the psycopg2 branch of the clone:
* https://github.com/dvarrazzo/gcc-python-plugin */
#if defined(WITH_CPYCHECKER_NULL_RESULT_SETS_EXCEPTION_ATTRIBUTE)
#define RAISES_NULL \
__attribute__((cpychecker_null_result_sets_exception))
#else
#define RAISES_NULL
#endif
#if defined(WITH_CPYCHECKER_IGNORE_REFCOUNT_ATTRIBUTE) #if defined(WITH_CPYCHECKER_IGNORE_REFCOUNT_ATTRIBUTE)
#define IGNORE_REFCOUNT \ #define IGNORE_REFCOUNT \
__attribute__((cpychecker_ignore_refcount)) __attribute__((cpychecker_ignore_refcount))

View File

@ -0,0 +1,36 @@
# docker build -f scripts/cpychecker.Dockerfile -t cpychecker scripts/
# docker run --rm -ti --name cpychecker --volume `pwd`:/psycopg2 cpychecker
FROM ubuntu:18.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
g++-6 \
gcc \
gcc-6-plugin-dev \
git \
libpq-dev \
make \
python-lxml \
python-pygments \
python-setuptools \
python-six \
python2.7 \
python2.7-dev \
&& rm -rf /var/lib/apt/lists/*
RUN git clone -b psycopg2 https://github.com/dvarrazzo/gcc-python-plugin.git
WORKDIR /gcc-python-plugin
ENV PYTHON=python2.7
ENV PYTHON_CONFIG=python2.7-config
ENV CC=gcc-6
RUN make PYTHON_CONFIG=$PYTHON_CONFIG plugin
# expected to be mounted
WORKDIR /psycopg2
ENV CC_FOR_CPYCHECKER=$CC
ENV CC=/gcc-python-plugin/gcc-with-cpychecker
CMD ["python2.7", "setup.py", "build"]
# CMD ["sleep", "infinity"]