diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3fb327e9c..f9faf4759c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,274 +1,275 @@ -# Copyright 2018-2019 the Pacemaker project contributors +# Copyright 2018-2020 the Pacemaker project contributors # # The version control history for this file may have further details. # -# SPDX-License-Identifier: FSFAP +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. # Conventions: # 0/ subject to change: compatibility with GitLab (CE) as old as 10.8 # 1/ heavy reuse (compatible map merges for now, see fedora-rawhide example) # 2/ consolidated prefixes for custom variable names: GLOBAL_* and LOCAL_* variables: GIT_DEPTH: "16" # nice-to-have automatic "bisect" for even more convenience stages: - buildenv - build - test # currently, 1:1 with the eponymous stage .buildenv: &buildenv-anchor stage: buildenv # currently, subset of all jobs pertaining "build" stage .compilation: &compilation-anchor variables: GLOBAL_COMPILATION: "1" # bogus content so that this anchor is not empty # only since GitLab 11.4 # changes: # - "configure.ac" # - "**/*.[ch]" # - "**/*.xml" # - "**/*.xsl" # - "**/Makefile.am" # - ".gitlab-ci.yml" # # Fedora Rawhide # # In case of failure imposed with branching/changed GPG keys, downgrade, e.g.: # sed -i.orig 's|fedora-rawhide|fedora|g;s|rawhide|fedora|g;s|:rawhide|:29|' \ # .gitlab-ci.yml # and run it through your side branch (omit such changes for upstream request). # .fedora-rawhide: &fedora-rawhide-anchor tags: - docker image: registry.fedoraproject.org/fedora:rawhide # down? mere fedora:rawhide .fedora-rawhide-variables-rpm: &fedora-rawhide-variables-rpm-anchor # below are captured major sets of packages that need to be installed on top # of what the base image contains; some packages named individually later; # transitive dependencies preferably kept at minimum, i.e., w/o proliferation GLOBAL_RPM_BR_BASIC: autoconf automake pkgconf-pkg-config libtool libtool-ltdl-devel make # with these two, first word denotes also the derived value of CC variable GLOBAL_RPM_BR_GCC: gcc GLOBAL_RPM_BR_CLANG: clang # compiler-rt # for when with coverage GLOBAL_RPM_BR_LIBS_PLAIN: libuuid-devel libxslt-devel bzip2-devel # note a special trick using \v escaped character, since it's not in IFS # (word separators) in Bash, while fulfilling the requirements in libdnf # (cf. https://github.com/rpm-software-management/libdnf/pull/476) GLOBAL_RPM_BR_LIBS_PKGCONFIG: "pkgconfig(glib-2.0)\v>=2.16.0 pkgconfig(libxml-2.0) pkgconfig(libqb)\v>=0.13 pkgconfig(libcpg)" GLOBAL_RPM_REQ_LIBS: bzip2-libs glib2 # not dragged transitively .fedora-rawhide-gcc: &fedora-rawhide-gcc-anchor <<: *fedora-rawhide-anchor #extends: .fedora-rawhide variables: <<: *fedora-rawhide-variables-rpm-anchor LOCAL_RPM_COMPILER: $GLOBAL_RPM_BR_GCC LOCAL_WITH_COVERAGE: --with-coverage .fedora-rawhide-clang: &fedora-rawhide-clang-anchor <<: *fedora-rawhide-anchor #extends: .fedora-rawhide variables: <<: *fedora-rawhide-variables-rpm-anchor LOCAL_RPM_COMPILER: $GLOBAL_RPM_BR_CLANG LOCAL_WITH_COVERAGE: "" # override from enabling in GCC case for now # buildenv buildenv:fedora-rawhide:info: # to gather some info about the image itself/container settings <<: *buildenv-anchor #extends: .buildenv <<: *fedora-rawhide-anchor #extends: .fedora-rawhide variables: GIT_STRATEGY: "none" # invariant stage, not project dependence at all script: - cat /proc/meminfo | grep Free - df -H - lsblk - nproc - ulimit -a - uname -r - dnf --version buildenv:fedora-rawhide:rpms: # primarily to download RPMs, but alas, "download" plugin not baked into image <<: *buildenv-anchor #extends: .buildenv <<: *fedora-rawhide-anchor #extends: .fedora-rawhide variables: <<: *fedora-rawhide-variables-rpm-anchor GIT_STRATEGY: "none" # invariant stage, not project dependence at all cache: key: "fedora-rawhide-dnf" paths: - ".cache/fedora-rawhide/dnf/rawhide-*" - "xml/assets/*.rng" script: - mkdir -p .cache/fedora-rawhide/dnf - pushd .cache/fedora-rawhide - mv dnf/rawhide-* /var/cache/dnf 2>/dev/null || true - dnf-custom() { timeout 192 dnf -y --noplugins --nodocs --setopt=tsflags=test --setopt=install_weak_deps=0 --setopt=keepcache=1 --setopt=autocheck_running_kernel=0 --disablerepo='*' --enablerepo=rawhide "$@"; }; dnf-custom install $GLOBAL_RPM_BR_BASIC $GLOBAL_RPM_BR_GCC $GLOBAL_RPM_BR_CLANG $GLOBAL_RPM_BR_LIBS_PLAIN $GLOBAL_RPM_BR_LIBS_PKGCONFIG $GLOBAL_RPM_REQ_LIBS findutils libxml libxslt psmisc which gcovr - mv /var/cache/dnf/rawhide-* dnf - popd # we don't have any other warm-up-cache job around, so piggyback it here - test -s xml/assets/relaxng.rng 2>/dev/null || curl -SsLo xml/assets/relaxng.rng 'https://raw.githubusercontent.com/relaxng/relaxng.org/master/relaxng.rng' - test -s xml/assets/xslt.rng 2>/dev/null || curl -SsLo xml/assets/xslt.rng 'https://raw.githubusercontent.com/relaxng/jing-trang/master/eg/xslt.rng' # build maint:fedora-rawhide: # to run some compilation-less checks <<: *fedora-rawhide-anchor #extends: .fedora-rawhide stage: build cache: key: "fedora-rawhide-dnf" policy: pull paths: - ".cache/fedora-rawhide/dnf/rawhide-*" - "xml/assets/*.rng" before_script: - mkdir -p .cache/fedora-rawhide/dnf - pushd .cache/fedora-rawhide - mv dnf/rawhide-* /var/cache/dnf 2>/dev/null || true - dnf-custom() { timeout 96 dnf -y --cacheonly --noplugins --nodocs --setopt=install_weak_deps=0 --setopt=autocheck_running_kernel=0 --disablerepo='*' --enablerepo=rawhide "$@"; }; dnf-custom install findutils make libxml libxslt - popd - ( cd xml; { cat Makefile.am; printf 'hack_rng\x3a %s' '${RNG_generated}'; } | make -f- top_srcdir=$(pwd)/.. top_builddir=$(pwd)/.. hack_rng ) script: - echo 'looking for presence of control characters...'; { git ls-files | xargs grep -Ensv "^([^[:cntrl:]]*|$(printf '\t'))*$"||:; } 2>/dev/null | { ! grep -Ev '^Binary file' && echo 'ALL OK'; }; - cd xml; ./regression.sh && ./regression.sh -B && ./regression.sh -S && { schemas=; for schema in *.rng; do case ${schema} in *cibtr*);; *)schemas="${schemas} ${schema}";; esac; done; xmllint --noout --relaxng assets/relaxng.rng ${schemas}; } build:fedora-rawhide:gcc: &build-fedora-rawhide-gcc-anchor # to build using GCC <<: *compilation-anchor #extends: .compilation <<: *fedora-rawhide-gcc-anchor #extends: .fedora-rawhide-gcc stage: build cache: key: "fedora-rawhide-dnf" policy: pull paths: - ".cache/fedora-rawhide/dnf/rawhide-*" artifacts: name: "fedora-rawhide-gcc-$CI_COMMIT_REF_SLUG" untracked: true expire_in: "10h" before_script: - mkdir -p .cache/fedora-rawhide/dnf - pushd .cache/fedora-rawhide - mv dnf/rawhide-* /var/cache/dnf 2>/dev/null || true - dnf-custom() { timeout 96 dnf -y --cacheonly --noplugins --nodocs --setopt=install_weak_deps=0 --setopt=autocheck_running_kernel=0 --disablerepo='*' --enablerepo=rawhide "$@"; }; dnf-custom install $GLOBAL_RPM_BR_BASIC $LOCAL_RPM_COMPILER $GLOBAL_RPM_BR_LIBS_PLAIN $GLOBAL_RPM_BR_LIBS_PKGCONFIG - popd script: - ./autogen.sh - CC=$(echo $LOCAL_RPM_COMPILER | cut -d ' ' -f1) ./configure --enable-silent-rules $LOCAL_WITH_COVERAGE || { cat config.log; false; } - timeout 480 make -j$(nproc) # -j$(($(nproc) + 1)) all - find \( -name '*.l[ao]' -o -name 'config.*' -o -name configure -o -name Makefile.in -o -name Makefile \) -delete # *.o need to remain for test build:fedora-rawhide:clang: # to build using Clang <<: *build-fedora-rawhide-gcc-anchor #extends build:fedora-rawhide:gcc <<: *fedora-rawhide-clang-anchor #extends: .fedora-rawhide-clang # test test:fedora-rawhide:gcc: &test-fedora-rawhide-gcc-anchor # to test the result of GCC build + measure coverage for that <<: *compilation-anchor #extends: .compilation <<: *fedora-rawhide-gcc-anchor #extends: .fedora-rawhide-gcc stage: test cache: key: "fedora-rawhide-dnf" policy: pull paths: - ".cache/fedora-rawhide/dnf/rawhide-*" dependencies: - build:fedora-rawhide:gcc before_script: - mkdir -p .cache/fedora-rawhide/dnf - pushd .cache/fedora-rawhide - mv dnf/rawhide-* /var/cache/dnf 2>/dev/null || true - dnf-custom() { timeout 96 dnf -y --cacheonly --noplugins --nodocs --setopt=install_weak_deps=0 --setopt=autocheck_running_kernel=0 --disablerepo='*' --enablerepo=rawhide "$@"; }; dnf-custom install $LOCAL_RPM_COMPILER $GLOBAL_RPM_BR_LIBS_PLAIN $GLOBAL_RPM_BR_LIBS_PKGCONFIG psmisc which $(test -z "$LOCAL_WITH_COVERAGE" || echo gcovr) findutils - popd script: - timeout 600 ./cts/cts-regression -V cli scheduler after_script: - gcovr -r . - find -name 'core*' || true coverage: '/^TOTAL.*\s+(\d+\%)$/' test:fedora-rawhide:clang: # to test the result of Clang build (+ possibly measure coverage for that) <<: *test-fedora-rawhide-gcc-anchor #extends: test:fedora-rawhide:gcc <<: *fedora-rawhide-clang-anchor #extends: .fedora-rawhide-clang dependencies: - build:fedora-rawhide:clang diff --git a/maint/gdb/gdbhelpers b/maint/gdb/gdbhelpers index ec2939bd0b..319a5f2544 100644 --- a/maint/gdb/gdbhelpers +++ b/maint/gdb/gdbhelpers @@ -1,108 +1,109 @@ -# Copyright 2018-2019 the Pacemaker project contributors +# Copyright 2018-2020 the Pacemaker project contributors # # The version control history for this file may have further details. # -# SPDX-License-Identifier: FSFAP +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. # notes: # "print"/"set" as "compile code" requires re-including headers/multi-line define pcmk # shelling avoids necessity to have an inferior around shell printf '%s %s\n\n' 'Available commands' \ '(all require an inferior, just break on main or so):' shell printf '%s\t%s\n' pcmk-follow-daemon \ 'Convenient pacemakerd to particular daemon descent' shell printf '%s\t%s\n' pcmk-xmlnode2file \ 'Convenient XML node to (specified/temporary) file dump' shell printf '%s\t%s\n' pcmk-terminate \ 'Convenient way to shut pacemaker down as a whole' end document pcmk Show possible pcmk namespace rooted user-defined convenience commands. end # XXX one would expect that order of pcmk_children naturally matches # the actual sequential ordering, but that's governed with start_seq define pcmk-follow-daemon dont-repeat set $d = $arg0 eval "set $d_alt = \"pacemaker-%s\"", $d set $cont = 1 break start_child cont while ($cont) if (!(int)strcmp(child->name, $d) || !(int)strcmp(child->name, $d_alt)) set $cont = 0 set follow-fork-mode child break getrlimit continue set follow-fork-mode parent # restore else if (child->start_seq == sizeof(pcmk_children)/sizeof(*pcmk_children) - 1) set $cont = 0 printf "no such daemon: %s (%s)\n", $d, $d_alt set follow-fork-mode parent # restore else continue end end end end document pcmk-follow-daemon Convenient way to follow into particular daemon when starting debugging from the master control process of pacemaker (pacemakerd). For "pacemaker-" prefixed daemons, this very prefix is not needed. Synopsis: pcmk-follow-daemon CHILD-DAEMON Examples: pcmk-follow-daemon "controld" end define pcmk-xmlnode2file dont-repeat set $n = $arg0 if ($argc > 1) set $fn = $arg1 else set $fn = tmpnam((void *) 0) printf "refer to this file: %s\n", $fn end set $f = (FILE *) fopen($fn, "w") eval "print (xmlElemDump((FILE *) %p, ((xmlNodePtr) %p)->doc, (xmlNodePtr) %p), \"%s\")", \ $f, $n, $n, "dump done" eval "print (fprintf((FILE *) %p, \"\\n\"), fclose((FILE *) %p), \"%s\")", \ $f, $f, "dump finished" end document pcmk-xmlnode2file Convenient way to dump an XML element to specified file, or a temporary file when it's not. Synopsis: pcmk-xmlnode2file XMLNODEPTR-EXPR [FILE-NAME] Examples: pcmk-xmlnode2file node "debug-dump.xml" pcmk-xmlnode2file elem end define pcmk-terminate dont-repeat eval "set $msg = \"\"", \ "t='crmd' subt='request' crm_task='quit' crm_sys_to='pacemakerd'" set $con = crm_ipc_new("pacemakerd", 0) eval "set $con_ok = crm_ipc_connect((crm_ipc_t *) %p)", $con if ($con_ok) eval "print (crm_ipc_send((crm_ipc_t *) %p, (xmlReadMemory(\"%s\", %u, %s))->children, %s), \"%s\")", \ $con, $msg, sizeof($msg), "\"gdb.xml\", (void *) 0, 0", "0, 0, (void *) 0", "terminating..." else print "cannot terminate, not running/listening?" end eval "print (crm_ipc_close((crm_ipc_t *) %p), \"connection closed\")", $con eval "print (crm_ipc_destroy((crm_ipc_t *) %p), \"connection destroyed\")", $con end document pcmk-terminate Convenient way to shut pacemaker down as a whole, no matter from which process, parent or child, and safely(!). Synopsis: pcmk-terminate end