Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist/tools/compile_test: Add Python3 support #5865

Merged
merged 1 commit into from
Jan 10, 2017

Conversation

jnohlgard
Copy link
Member

@jnohlgard jnohlgard commented Sep 26, 2016

Tested working in Python 2.7.12 and Python 3.4.5

Python 3 is becoming more widely supported by distributions, so it is wise to stay up to date with our scripts so that they continue to run in the future.

@jnohlgard jnohlgard added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: CI Area: Continuous Integration of RIOT components labels Sep 26, 2016
@jnohlgard jnohlgard added this to the Release 2016.10 milestone Sep 26, 2016
results_with_output = filter(lambda (outcome, board, output): output.getvalue(), results_with_output)
failed_with_output = filter(lambda (outcome, board, output): 'failed' in outcome, results_with_output)
success_with_output = filter(lambda (outcome, board, output): 'success' in outcome, results_with_output)
results = groupby(sorted(results), lambda res: res[0])
Copy link
Member Author

@jnohlgard jnohlgard Sep 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a bit ugly and makes it less readable, but it was the only way I could get it to work in both Python 2.7 and Python 3.x without resorting to writing two separate if branches.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not less readable as before IMHO ^^.

Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with the changes. ACK.

results_with_output = filter(lambda (outcome, board, output): output.getvalue(), results_with_output)
failed_with_output = filter(lambda (outcome, board, output): 'failed' in outcome, results_with_output)
success_with_output = filter(lambda (outcome, board, output): 'success' in outcome, results_with_output)
results = groupby(sorted(results), lambda res: res[0])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not less readable as before IMHO ^^.

@miri64
Copy link
Member

miri64 commented Sep 26, 2016

Can you squash, please?

@jnohlgard jnohlgard force-pushed the pr/compile-test-py3 branch 2 times, most recently from a21e3c6 to 64e1f23 Compare September 26, 2016 09:20
results = groupby(sorted(results), lambda res: res[0])
results_with_output = list(filter(lambda res: res[2].getvalue(), results_with_output))
failed_with_output = list(filter(lambda res: 'failed' in res[0], results_with_output))
success_with_output = list(filter(lambda res: 'success' in res[0], results_with_output))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found an error with Python3 when counting the number or errors and warnings. Fixed by explicitly constructing a list from the iterator produced by the filter function. (Python2 filter produces a list directly)

@jnohlgard
Copy link
Member Author

Fixed a mistake when using Python3 and printing the errors, immediately squashed. (Added the list constructor on the three xxx_with_output lines)

@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Sep 26, 2016
@miri64
Copy link
Member

miri64 commented Sep 26, 2016

Somehow Murdock does not want to start building. @kaspar030 any idea?

@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Sep 26, 2016
@jnohlgard jnohlgard added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Sep 26, 2016
@kaspar030 kaspar030 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Sep 26, 2016
@kaspar030
Copy link
Contributor

Somehow Murdock does not want to start building. @kaspar030 any idea?

There's a concurrency bug in murdock which makes it get stuck sometimes. Happened two or three times in the last six months, and I don't have an easy way to trigger it. I've now added a little more conservative locking and hope it will help.

@miri64
Copy link
Member

miri64 commented Sep 27, 2016

Something went wrong. Murdock reports fails where there are none :-/

@jnohlgard
Copy link
Member Author

oops, Python exception in unittests. I'll investigate later

@miri64
Copy link
Member

miri64 commented Oct 24, 2016

@gebart ping?

@miri64
Copy link
Member

miri64 commented Oct 31, 2016

Postponed due to feature freeze

@miri64 miri64 modified the milestones: Release 2017.01, Release 2016.10 Oct 31, 2016
@jnohlgard jnohlgard removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Dec 28, 2016
@jnohlgard jnohlgard added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Dec 28, 2016
@jnohlgard
Copy link
Member Author

I am trying to debug the Python unicode exceptions via Murdock because I haven't been able to reproduce them locally.

@jnohlgard jnohlgard added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Dec 29, 2016
@kaspar030 kaspar030 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jan 3, 2017
@kaspar030
Copy link
Contributor

Somehow the buildgroups get stuck. ps output looks like this:

riot-ci   3898  0.0  0.0  18052  2232 ?        S    00:13   0:00                  \_ /bin/bash bin/build_all.sh
riot-ci   3931  0.0  0.0  18060  2764 ?        S    00:13   0:00                      \_ bash ./dist/tools/ci/build_and_test.sh
riot-ci   3941  0.0  0.0  22016  7036 ?        S    00:13   0:00                          \_ python ./dist/tools/compile_test/compile_test.py master
riot-ci   4057  0.0  0.0   7588  2904 ?        S    00:13   0:00                              \_ make buildtest
riot-ci   5806  0.0  0.0   4532  1740 ?        S    00:13   0:00                                  \_ /bin/sh -c \ BUILDTESTOK=true; \ APP_RETRY=0; \ for BOARD in $(make -s info-boards-supported); do \   RIOTNOLINK=$(echo airfy-beacon cc2650stk chronos ek-lm4f120xl msb-430 msb-430h pca10000 pca10005 spark-core stm32f0discovery stm32f3discovery telosb wsn430-v1_3b wsn430-v1_4 z1 nucleo-f103 nucleo-f334 yunjia-nrf51822 samr21-xpro arduino-mega2560 airfy-beacon nrf51dongle nrf6310 weio waspmote-pro nucleo-f072 arduino-uno arduino-duemilanove sodaq-autonomo arduino-zero nucleo-f030 nucleo-f070 nucleo-f091 pba-d-01-kw2x saml21-xpro microbit calliope-mini limifrog-v1 slwstk6220a | grep ${BOARD} 2>&1 >/dev/null && echo 1); \   /bin/echo -n "Building for ${BOARD} "; \   [ -n "${RIOTNOLINK}" ] && /bin/echo -n "(no linking) "; \   for NTH_TRY in 1 2 3; do \     /bin/echo -n ".. "; \     if [ "$NTH_TRY" != "3" ]; then export _CCACHE=$CCACHE; else export _CCACHE=""; fi ; \     LOG=$(env -i HOME=${HOME} PATH=${PATH} BOARD=${BOARD} CCACHE=${_CCACHE} ${CCACHE_DIR:+CCACHE_DIR=${CCACHE_DIR}} ${GIT_CACHE_DIR:+GIT_CACHE_DIR=${GIT_CACHE_DIR}} CCACHE_BASEDIR=${CCACHE_BASEDIR} RIOTBASE=${RIOTBASE} RIOTBOARD=${RIOTBOARD} RIOTCPU=${RIOTCPU} RIOTPKG=${RIOTPKG} BINDIRBASE=${BINDIRBASE} RIOTNOLINK=${RIOTNOLINK} RIOT_VERSION=${RIOT_VERSION} WERROR=${WERROR} LTO=${LTO} TOOLCHAIN=${TOOLCHAIN} make -j8 clean all 2>&1) ; \     if [ "${?}" = "0" ]; then \       /bin/echo "success"; \       if [ -n "${BUILDTEST_VERBOSE}" ]; then \         echo "${LOG}" | tail -n +2 | head -n -2 | grep -v -E '^Building application|^\"make|^patching' | awk 'NF'; \       fi; \     elif [ -n "${RIOT_DO_RETRY}" ] && [ "${APP_RETRY}" -lt "3" ] && [ ${NTH_TRY} != 3 ]; then \       /bin/echo -n "retrying "; \       continue; \     else \       /bin/echo "failed"; \       if [ -n "${BUILDTEST_VERBOSE}" ]; then \         echo "${LOG}" | grep -v -E '^\"make'; \       fi; \       APP_RETRY=`expr ${APP_RETRY} + 1`; \       BUILDTESTOK=false; \     fi; \     break; \   done; \   env -i \     HOME=${HOME} \     PATH=${PATH} \     BOARD=${BOARD} \     CCACHE=${CCACHE} \     ${CCACHE_DIR:+CCACHE_DIR=${CCACHE_DIR}} \     CCACHE_BASEDIR=${CCACHE_BASEDIR} \     ${GIT_CACHE_DIR:+GIT_CACHE_DIR=${GIT_CACHE_DIR}} \     RIOTBASE=${RIOTBASE} \     RIOTBOARD=${RIOTBOARD} \     RIOTCPU=${RIOTCPU} \     RIOTPKG=${RIOTPKG} \     BINDIRBASE=${BINDIRBASE} \     RIOTNOLINK=${RIOTNOLINK} \     RIOT_VERSION=${RIOT_VERSION} \     make clean-intermediates 2>&1 >/dev/null || true; \ done; \ ${BUILDTESTOK}
riot-ci   9757  0.0  0.0   7600   980 ?        S    00:14   0:00                                      \_ awk NF

@jnohlgard jnohlgard added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 6, 2017
Tested with Python 2.7.12 and Python 3.4.5
@jnohlgard
Copy link
Member Author

@kaspar030 the exception came from ISO8859-1 encoded ó in the output from some pkg/relic code preparation, unsure whether the hung task was also related to that. The exception went away when I added errors='replace' on the decode line, which will replace any non-UTF8 letters by a special character (0xfffd) instead of raising an exception.

Updated commit by adding errors='replace', immediately squashed

Copy link
Contributor

@kaspar030 kaspar030 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. ACK if Murdock agrees!

@miri64 miri64 merged commit 600fdb8 into RIOT-OS:master Jan 10, 2017
@jnohlgard jnohlgard deleted the pr/compile-test-py3 branch January 11, 2017 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: CI Area: Continuous Integration of RIOT components Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants