From 499e6534a1557bd86744f0457b59abf0ac87b97b Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Mon, 25 Mar 2019 22:11:14 -0400 Subject: [PATCH 01/12] removed CATKIN_PKG arg --- Dockerfile | 7 +------ scripts/build-bugzoo.py | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index d9345485..a4f2296a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,9 +12,6 @@ # If set to true, the resulting Docker image will attempt to use archival # package sources. Allows "apt-get" to be used with versions of Ubuntu # that are no longer maintained. -# CATKIN_PKG -- the local name of the package under test (i.e., the name -# of the directory inside "source" that will contain the source code for -# the package under test). # REPO_FORK_URL -- the URL of the ROBUST fork Git repository for this bug. # REPO_BUG_COMMIT -- the SHA-1 hash for the commit in the forked repository # that provides the buggy version of the code. This version of the code @@ -42,7 +39,6 @@ RUN echo "[ROBUST] cloning repo: '${REPO_FORK_URL}'" \ FROM ubuntu:${UBUNTU_VERSION} ARG ROS_DISTRO ARG USE_APT_OLD_RELEASES -ARG CATKIN_PKG ARG REPO_FIX_COMMIT ARG REPO_BUG_COMMIT ARG IS_BUILD_FAILURE @@ -178,10 +174,9 @@ echo \"switched mode to: \$1\"" > switch \ # expected to be a build failure. # we use '--only-pkg-with-deps' to avoid building /everything/ RUN echo "[ROBUST] creating build script" \ - && echo "[ROBUST] PUT is provided by catkin package: '${CATKIN_PKG}'" \ && echo "#!/bin/bash\n\ source /opt/ros/$ROS_DISTRO/setup.bash \ - && catkin_make --only-pkg-with-deps=${CATKIN_PKG}" > build.sh \ + && catkin build" > build.sh \ && chmod +x build.sh \ && echo "[ROBUST] created build script" RUN echo "[ROBUST] attempting to build PUT..." \ diff --git a/scripts/build-bugzoo.py b/scripts/build-bugzoo.py index 6442befd..ee4dcda9 100644 --- a/scripts/build-bugzoo.py +++ b/scripts/build-bugzoo.py @@ -102,7 +102,6 @@ def report_error(m): 'USE_OSRF_REPOS': use_osrf_repos, 'UBUNTU_VERSION': ubuntu_version, 'ROS_DISTRO': ros_distro, - 'CATKIN_PKG': catkin_pkg, # FIXME 'REPO_FORK_URL': url_forks[0], # FIXME 'REPO_BUG_COMMIT': sha_bug, 'REPO_FIX_COMMIT': sha_fix From d15e010424f75daf9571bc48fe726d3bccf0864f Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Mon, 25 Mar 2019 22:16:29 -0400 Subject: [PATCH 02/12] remove multiple PUT warning and add multiple fork warning --- scripts/build-bugzoo.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/build-bugzoo.py b/scripts/build-bugzoo.py index ee4dcda9..cc749ab1 100644 --- a/scripts/build-bugzoo.py +++ b/scripts/build-bugzoo.py @@ -67,17 +67,12 @@ def report_error(m): report_error("'is_build_failure' should be a boolean") continue - if len(ros_pkgs) > 1: - warnings.warn('BugZoo file does not currently support multiple PUTs') - continue - catkin_pkg = ros_pkgs[0] - if not isinstance(url_forks, list): report_error("'bugzoo.url-forks' should be a list") continue if len(url_forks) > 1: - warnings.warn("build-bugzoo.py does not currently support multiple PUTs") + report_error("BugZoo file does not support multiple forks.") continue # determine Ubuntu version based on ROS distro From 7a66983310123f9c640f3a55428591f067dced41 Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Mon, 25 Mar 2019 22:24:10 -0400 Subject: [PATCH 03/12] remove program line --- scripts/build-bugzoo.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/build-bugzoo.py b/scripts/build-bugzoo.py index cc749ab1..9d5bd46f 100644 --- a/scripts/build-bugzoo.py +++ b/scripts/build-bugzoo.py @@ -112,7 +112,6 @@ def report_error(m): bugs.append({ 'name': 'robust:{}'.format(bug_id), 'image': name_image, - 'program': catkin_pkg, 'dataset': 'robust', 'languages': ['cpp'], # FIXME 'source-location': '/ros_ws/src', From 8ec0fd174f3b2ad0875de9a4313914c9ca88dcd8 Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Mon, 25 Mar 2019 23:20:34 -0400 Subject: [PATCH 04/12] added CATKIN_PACKAGES arg --- Dockerfile | 8 ++++++-- scripts/build-bugzoo.py | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a4f2296a..4ba41681 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ # If set to true, the resulting Docker image will attempt to use archival # package sources. Allows "apt-get" to be used with versions of Ubuntu # that are no longer maintained. +# CATKIN_PACKAGES -- the names of the packages under test. # REPO_FORK_URL -- the URL of the ROBUST fork Git repository for this bug. # REPO_BUG_COMMIT -- the SHA-1 hash for the commit in the forked repository # that provides the buggy version of the code. This version of the code @@ -95,6 +96,7 @@ RUN pip install --upgrade \ rosinstall \ rospkg \ catkin_pkg \ + catkin_tools \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -172,14 +174,16 @@ echo \"switched mode to: \$1\"" > switch \ # package(s) under test. # we now attempt to build the workspace, and suppress any errors if the bug is # expected to be a build failure. -# we use '--only-pkg-with-deps' to avoid building /everything/ +ARG CATKIN_PACKAGES +ENV CATKIN_PACKAGES "${CATKIN_PACKAGES}" RUN echo "[ROBUST] creating build script" \ && echo "#!/bin/bash\n\ source /opt/ros/$ROS_DISTRO/setup.bash \ - && catkin build" > build.sh \ + && catkin build ${CATKIN_PACKAGES}" > build.sh \ && chmod +x build.sh \ && echo "[ROBUST] created build script" RUN echo "[ROBUST] attempting to build PUT..." \ + && echo "[ROBUST] building packages: ${CATKIN_PACKAGES}" \ && echo "[ROBUST] is a build failure expected? ${IS_BUILD_FAILURE}." \ && ./build.sh || [ "${IS_BUILD_FAILURE}" = "yes" ] COPY test.sh . diff --git a/scripts/build-bugzoo.py b/scripts/build-bugzoo.py index 9d5bd46f..2ce22f29 100644 --- a/scripts/build-bugzoo.py +++ b/scripts/build-bugzoo.py @@ -97,6 +97,7 @@ def report_error(m): 'USE_OSRF_REPOS': use_osrf_repos, 'UBUNTU_VERSION': ubuntu_version, 'ROS_DISTRO': ros_distro, + 'CATKIN_PACKAGES': ros_pkgs, 'REPO_FORK_URL': url_forks[0], # FIXME 'REPO_BUG_COMMIT': sha_bug, 'REPO_FIX_COMMIT': sha_fix From 4fe7e1b9e7ad4dcda77c2820945f9daedbe13f84 Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Mon, 25 Mar 2019 23:31:55 -0400 Subject: [PATCH 05/12] fix CATKIN_PACKAGES build arg --- scripts/build-bugzoo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-bugzoo.py b/scripts/build-bugzoo.py index 2ce22f29..271dd74b 100644 --- a/scripts/build-bugzoo.py +++ b/scripts/build-bugzoo.py @@ -97,7 +97,7 @@ def report_error(m): 'USE_OSRF_REPOS': use_osrf_repos, 'UBUNTU_VERSION': ubuntu_version, 'ROS_DISTRO': ros_distro, - 'CATKIN_PACKAGES': ros_pkgs, + 'CATKIN_PACKAGES': ' '.join(ros_pkgs), 'REPO_FORK_URL': url_forks[0], # FIXME 'REPO_BUG_COMMIT': sha_bug, 'REPO_FIX_COMMIT': sha_fix From cccd0f1e22f1968655448a3e0c271c9010d5da57 Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Mon, 25 Mar 2019 23:37:03 -0400 Subject: [PATCH 06/12] added catkin init --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 4ba41681..75cdb578 100644 --- a/Dockerfile +++ b/Dockerfile @@ -185,6 +185,7 @@ RUN echo "[ROBUST] creating build script" \ RUN echo "[ROBUST] attempting to build PUT..." \ && echo "[ROBUST] building packages: ${CATKIN_PACKAGES}" \ && echo "[ROBUST] is a build failure expected? ${IS_BUILD_FAILURE}." \ + && catkin init \ && ./build.sh || [ "${IS_BUILD_FAILURE}" = "yes" ] COPY test.sh . From f9b382c7bc28580c3d7267ab847ce6183b8307aa Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Tue, 26 Mar 2019 11:18:55 -0400 Subject: [PATCH 07/12] tag buggy stage --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 75cdb578..8dd3641e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ RUN echo "[ROBUST] cloning repo: '${REPO_FORK_URL}'" \ && git clone "${REPO_FORK_URL}" /tmp/repo-under-test \ && echo "[ROBUST] cloned repo." -FROM ubuntu:${UBUNTU_VERSION} +FROM ubuntu:${UBUNTU_VERSION} as buggy ARG ROS_DISTRO ARG USE_APT_OLD_RELEASES ARG REPO_FIX_COMMIT From 6cf6cabed0f92f7713eedd05c23f26cc9c0f4212 Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Tue, 26 Mar 2019 11:19:56 -0400 Subject: [PATCH 08/12] remove fix and switch scripts --- Dockerfile | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8dd3641e..258f0b98 100644 --- a/Dockerfile +++ b/Dockerfile @@ -156,16 +156,6 @@ RUN cd src/repo-under-test \ && git reset --hard "${REPO_BUG_COMMIT}" \ && echo "[ROBUST] fetched fixed and buggy source code." -# generate fix and unfix scripts -RUN echo "#!/bin/bash\n\ -pushd '${ROS_WSPACE}/src/repo-under-test' && \n\ -git clean -dfx && \n\ -git checkout \"\$1\" && \n\ -echo \"switched mode to: \$1\"" > switch \ - && echo "#!/bin/bash\n'${ROS_WSPACE}/switch' \"\${REPO_FIX_COMMIT}\"" > fix \ - && echo "#!/bin/bash\n'${ROS_WSPACE}/switch' \"\${REPO_BUG_COMMIT}\"" > unfix \ - && chmod +x fix unfix switch - # dependencies should already have been resolved, built and installed, so we # can skip running rosdep here. We do of course depend on the package author # to have correctly listed all dependencies .. From c5cdfc986aeab0ff87489a137771b42bed06a258 Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Tue, 26 Mar 2019 11:24:38 -0400 Subject: [PATCH 09/12] optimise patch construction --- Dockerfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 258f0b98..86d56987 100644 --- a/Dockerfile +++ b/Dockerfile @@ -133,7 +133,7 @@ RUN cd /usr/src/gtest \ && cmake CMakeLists.txt \ && make -# build workspace and install source-based dependencies +# build workspace and install source-based dependencies for buggy version RUN ${ROS_WSPACE}/src/catkin/bin/catkin_make_isolated \ --install \ --install-space /opt/ros/${ROS_DISTRO} \ @@ -143,7 +143,7 @@ RUN ${ROS_WSPACE}/src/catkin/bin/catkin_make_isolated \ ${ROS_WSPACE}/build_isolated \ ${ROS_WSPACE}/devel_isolated -# download & build Package Under Test +# download & build PUTs COPY --from=fork /tmp/repo-under-test src/repo-under-test ENV REPO_FIX_COMMIT "${REPO_FIX_COMMIT}" ENV REPO_BUG_COMMIT "${REPO_BUG_COMMIT}" @@ -154,7 +154,9 @@ RUN cd src/repo-under-test \ && git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" \ && git fetch --all \ && git reset --hard "${REPO_BUG_COMMIT}" \ - && echo "[ROBUST] fetched fixed and buggy source code." + && echo "[ROBUST] fetched fixed and buggy source code." \ + && git diff "${REPO_BUG_COMMIT}" "${REPO_FIX_COMMIT}" > "${ROS_WSPACE}/fix.patch" \ + && echo "[ROBUST] built historical patch." # dependencies should already have been resolved, built and installed, so we # can skip running rosdep here. We do of course depend on the package author @@ -178,7 +180,3 @@ RUN echo "[ROBUST] attempting to build PUT..." \ && catkin init \ && ./build.sh || [ "${IS_BUILD_FAILURE}" = "yes" ] COPY test.sh . - -# automatically generate historical patch -RUN cd src/repo-under-test \ - && git diff "${REPO_BUG_COMMIT}" "${REPO_FIX_COMMIT}" > "${ROS_WSPACE}/fix.patch" From 79be4200da3eda4d4dd3465de5c6253550cbaf8b Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Tue, 26 Mar 2019 11:41:34 -0400 Subject: [PATCH 10/12] added fixed stage to Dockerfile and added optimisation --- Dockerfile | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 86d56987..162b6970 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ RUN echo "[ROBUST] cloning repo: '${REPO_FORK_URL}'" \ && git clone "${REPO_FORK_URL}" /tmp/repo-under-test \ && echo "[ROBUST] cloned repo." -FROM ubuntu:${UBUNTU_VERSION} as buggy +FROM ubuntu:${UBUNTU_VERSION} as _buggy ARG ROS_DISTRO ARG USE_APT_OLD_RELEASES ARG REPO_FIX_COMMIT @@ -179,4 +179,29 @@ RUN echo "[ROBUST] attempting to build PUT..." \ && echo "[ROBUST] is a build failure expected? ${IS_BUILD_FAILURE}." \ && catkin init \ && ./build.sh || [ "${IS_BUILD_FAILURE}" = "yes" ] -COPY test.sh . + +# we build the fixed image on top of the buggy image +FROM _buggy as _fixed + +# TODO: build additional/changed dependencies via fixed.rosinstall +RUN cd src/repo-under-test \ + && echo "[ROBUST] checking out fix commit" \ + && git checkout "${REPO_FIX_COMMIT}" \ + && echo "[ROBUST] checked out fix commit: ${REPO_FIX_COMMIT}" \ + && echo "[ROBUST] running rosdep on fixed version" \ + && rosdep update \ + && rosdep install --from-paths src -i --rosdistro=${ROS_DISTRO} -y \ + --skip-keys="python-rosdep python-catkin-pkg python-rospkg" \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && echo "[ROBUST] finished running rosdep on fixed version" \ + && echo "[ROBUST] building fixed version" \ + && ./build.sh \ + && echo "[ROBUST] finished building fixed version" + +# we use a separate build stage to add the test script to avoid breaking +# the build cache and doing unnecessary work +FROM _buggy as buggy +COPY test.sh +FROM _fixed as fixed +COPY test.sh From 27bd4d892bf75f670448f2ec4ea83ff33adc0805 Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Tue, 26 Mar 2019 11:49:17 -0400 Subject: [PATCH 11/12] bug fix: bad stage names and malformed COPY commands --- Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 162b6970..27f951fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ RUN echo "[ROBUST] cloning repo: '${REPO_FORK_URL}'" \ && git clone "${REPO_FORK_URL}" /tmp/repo-under-test \ && echo "[ROBUST] cloned repo." -FROM ubuntu:${UBUNTU_VERSION} as _buggy +FROM ubuntu:${UBUNTU_VERSION} as temp_buggy ARG ROS_DISTRO ARG USE_APT_OLD_RELEASES ARG REPO_FIX_COMMIT @@ -181,7 +181,7 @@ RUN echo "[ROBUST] attempting to build PUT..." \ && ./build.sh || [ "${IS_BUILD_FAILURE}" = "yes" ] # we build the fixed image on top of the buggy image -FROM _buggy as _fixed +FROM temp_buggy as temp_fixed # TODO: build additional/changed dependencies via fixed.rosinstall RUN cd src/repo-under-test \ @@ -201,7 +201,7 @@ RUN cd src/repo-under-test \ # we use a separate build stage to add the test script to avoid breaking # the build cache and doing unnecessary work -FROM _buggy as buggy -COPY test.sh -FROM _fixed as fixed -COPY test.sh +FROM temp_buggy as buggy +COPY test.sh . +FROM temp_fixed as fixed +COPY test.sh . From 9a5429eb2dc7c1b876edf9d03618f9ab3a2b2884 Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Tue, 26 Mar 2019 13:45:08 -0400 Subject: [PATCH 12/12] switch to ROS workspace --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 27f951fd..e6b66e1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -189,6 +189,8 @@ RUN cd src/repo-under-test \ && git checkout "${REPO_FIX_COMMIT}" \ && echo "[ROBUST] checked out fix commit: ${REPO_FIX_COMMIT}" \ && echo "[ROBUST] running rosdep on fixed version" \ + && cd "${ROS_WSPACE}" \ + && apt-get update \ && rosdep update \ && rosdep install --from-paths src -i --rosdistro=${ROS_DISTRO} -y \ --skip-keys="python-rosdep python-catkin-pkg python-rospkg" \