From 29989ffbfb7c23ef8335e917ef0c292af05ad916 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Wed, 31 Jul 2019 22:46:09 +0100 Subject: [PATCH 1/9] Test for go --- azure-pipelines.yml | 6 +++++ tests/ci/image/Dockerfile | 20 ++++++++++++++++- tests/ci/rebuild | 8 ++++++- tests/language_go.test.vim | 46 ++++++++++++++++++++++++++++++++++++++ tests/manual/rebuild | 8 ++++++- tests/manual/run | 2 ++ 6 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 tests/language_go.test.vim diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3ffbc7c..79f5e38 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,6 +37,9 @@ stages: image: 'puremourning/vimspector:test' options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined steps: + - bash: go get -u github.com/go-delve/delve/cmd/dlv + displayName: 'Install Delve for Go' + - bash: python3 install_gadget.py --all displayName: 'Install gadgets' @@ -63,6 +66,9 @@ stages: - bash: brew install macvim displayName: 'Install vim' + - bash: go get -u github.com/go-delve/delve/cmd/dlv + displayName: 'Install Delve for Go' + - bash: python3 install_gadget.py --all displayName: 'Install gadgets' diff --git a/tests/ci/image/Dockerfile b/tests/ci/image/Dockerfile index b315431..8638fa9 100644 --- a/tests/ci/image/Dockerfile +++ b/tests/ci/image/Dockerfile @@ -1,18 +1,22 @@ FROM ubuntu:18.04 ENV DEBIAN_FRONTEND=noninteractive +ENV LC_ALL C.UTF-8 RUN apt-get update && \ apt-get -y dist-upgrade && \ apt-get -y install python3-dev \ python3-pip \ ca-cacert \ + locales \ + language-pack-en \ libncurses5-dev libncursesw5-dev \ git \ tcl-dev \ tcllib \ gdb \ - lldb && \ + lldb \ + curl && \ apt-get -y autoremove RUN ln -fs /usr/share/zoneinfo/Europe/London /etc/localtime && \ @@ -36,3 +40,17 @@ RUN mkdir -p $HOME/vim && \ git checkout ${VIM_VERSION} && \ make -j 4 install +# linuxbrew (homebrew) +RUN mkdir -p /home/linuxbrew/.linuxbrew &&\ + chmod -R go+rwx /home/linuxbrew && \ + mkdir -p /home/linuxbrew/.linuxbrew/bin && \ + git clone https://github.com/Homebrew/brew /home/linuxbrew/.linuxbrew/Homebrew && \ + ln -s /home/linuxbrew/.linuxbrew/Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin && \ + echo "eval \$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" \ + > /etc/bash.bashrc + +RUN /home/linuxbrew/.linuxbrew/bin/brew install golang + +# clean up +RUN /home/linuxbrew/.linuxbrew/bin/brew cleanup && \ + rm -rf ~/.cache diff --git a/tests/ci/rebuild b/tests/ci/rebuild index 1ac5b37..2ba3f13 100755 --- a/tests/ci/rebuild +++ b/tests/ci/rebuild @@ -2,4 +2,10 @@ set -e -docker build --no-cache -t puremourning/vimspector:test image/ +if [ "$1" = "--continue" ]; then + OPTS="" +else + OPTS="--no-cache" +fi + +docker build ${OPTS} -t puremourning/vimspector:test image/ diff --git a/tests/language_go.test.vim b/tests/language_go.test.vim new file mode 100644 index 0000000..7fb9c9d --- /dev/null +++ b/tests/language_go.test.vim @@ -0,0 +1,46 @@ +function! SetUp() + call vimspector#test#setup#SetUpWithMappings( v:none ) +endfunction + +function! ClearDown() + call vimspector#test#setup#ClearDown() +endfunction + +function! SetUp_Test_Go_Simple() + let g:vimspector_enable_mappings = 'HUMAN' +endfunction + +function! Test_Go_Simple() + let fn='hello-world.go' + lcd ../support/test/go/hello_world + exe 'edit ' . fn + call setpos( '.', [ 0, 4, 1 ] ) + + call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 4, 1 ) + call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 4 ) + + " Add the breakpoint + call feedkeys( "\", 'xt' ) + call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP', + \ 4, + \ 'vimspectorBP' ) + + call setpos( '.', [ 0, 1, 1 ] ) + + " Here we go. Start Debugging + call feedkeys( "\", 'xt' ) + call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 4, 1 ) + + " Step + call feedkeys( "\", 'xt' ) + + call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 5, 1 ) + call WaitForAssert( {-> + \ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 5 ) + \ } ) + + call vimspector#test#setup#Reset() + + lcd - + %bwipeout! +endfunction diff --git a/tests/manual/rebuild b/tests/manual/rebuild index 224db25..05cd995 100755 --- a/tests/manual/rebuild +++ b/tests/manual/rebuild @@ -2,4 +2,10 @@ set -e -docker build --no-cache -t puremourning/vimspector:manual image/ +if [ "$1" = "--continue" ]; then + OPTS="" +else + OPTS="--no-cache" +fi + +docker build ${OPTS} -t puremourning/vimspector:manual image/ diff --git a/tests/manual/run b/tests/manual/run index 08303a7..bdf8dc0 100755 --- a/tests/manual/run +++ b/tests/manual/run @@ -4,6 +4,8 @@ CONTAINER=puremourning/vimspector:manual if [ "$@" ];then CMD="$@" +else + CMD="bash -l" fi docker run --cap-add=SYS_PTRACE \ From 53f61d150f1968280c9fdfb17b8a47a57b2ee556 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 1 Aug 2019 22:16:31 +0100 Subject: [PATCH 2/9] Use the profile and rc files --- azure-pipelines.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 79f5e38..def95e0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -38,20 +38,30 @@ stages: options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined steps: - bash: go get -u github.com/go-delve/delve/cmd/dlv + noProfile: false + noRc: false displayName: 'Install Delve for Go' - bash: python3 install_gadget.py --all + noProfile: false + noRc: false displayName: 'Install gadgets' - bash: vim --version + noProfile: false + noRc: false displayName: 'Print vim version information' - bash: ./run_tests + noProfile: false + noRc: false displayName: 'Run the tests' env: VIMSPECTOR_MIMODE: gdb - bash: ./make_package linux $(Build.SourceVersion) + noProfile: false + noRc: false displayName: 'Package' - task: PublishPipelineArtifact@0 From eefb0c5c6bed2765a7dcd9fef5a6cacc313e231b Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 1 Aug 2019 22:20:53 +0100 Subject: [PATCH 3/9] Alternative syntax required for some bizarre reason --- azure-pipelines.yml | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index def95e0..44d7112 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,31 +37,36 @@ stages: image: 'puremourning/vimspector:test' options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined steps: - - bash: go get -u github.com/go-delve/delve/cmd/dlv - noProfile: false - noRc: false + - task: bash@3 + inputs: + targetType: inline + script: go get -u github.com/go-delve/delve/cmd/dlv + noProfile: false + noRc: false displayName: 'Install Delve for Go' - - bash: python3 install_gadget.py --all - noProfile: false - noRc: false + - task: bash@3 + inputs: + targetType: inline + script: python3 install_gadget.py --all + noProfile: false + noRc: false displayName: 'Install gadgets' - bash: vim --version - noProfile: false - noRc: false displayName: 'Print vim version information' - - bash: ./run_tests - noProfile: false - noRc: false - displayName: 'Run the tests' + - task: bash@3 + inputs: + targetType: inline + script: ./run_tests + noProfile: false + noRc: false env: VIMSPECTOR_MIMODE: gdb + displayName: 'Run the tests' - bash: ./make_package linux $(Build.SourceVersion) - noProfile: false - noRc: false displayName: 'Package' - task: PublishPipelineArtifact@0 From df8c0179d1f60515d661f8e4037b4eb5c7321bbf Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 1 Aug 2019 22:32:53 +0100 Subject: [PATCH 4/9] Print env --- azure-pipelines.yml | 25 ++++++------------------- tests/ci/image/Dockerfile | 2 +- tests/manual/run | 8 +------- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 44d7112..7b29132 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,34 +37,21 @@ stages: image: 'puremourning/vimspector:test' options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined steps: - - task: bash@3 - inputs: - targetType: inline - script: go get -u github.com/go-delve/delve/cmd/dlv - noProfile: false - noRc: false + - bash: | + eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + go get -u github.com/go-delve/delve/cmd/dlv displayName: 'Install Delve for Go' - - task: bash@3 - inputs: - targetType: inline - script: python3 install_gadget.py --all - noProfile: false - noRc: false + - bash: python3 install_gadget.py --all displayName: 'Install gadgets' - bash: vim --version displayName: 'Print vim version information' - - task: bash@3 - inputs: - targetType: inline - script: ./run_tests - noProfile: false - noRc: false + - bash: ./run_tests + displayName: 'Run the tests' env: VIMSPECTOR_MIMODE: gdb - displayName: 'Run the tests' - bash: ./make_package linux $(Build.SourceVersion) displayName: 'Package' diff --git a/tests/ci/image/Dockerfile b/tests/ci/image/Dockerfile index 8638fa9..d05c124 100644 --- a/tests/ci/image/Dockerfile +++ b/tests/ci/image/Dockerfile @@ -47,7 +47,7 @@ RUN mkdir -p /home/linuxbrew/.linuxbrew &&\ git clone https://github.com/Homebrew/brew /home/linuxbrew/.linuxbrew/Homebrew && \ ln -s /home/linuxbrew/.linuxbrew/Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin && \ echo "eval \$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" \ - > /etc/bash.bashrc + > /etc/skel/.bashrc RUN /home/linuxbrew/.linuxbrew/bin/brew install golang diff --git a/tests/manual/run b/tests/manual/run index bdf8dc0..ed0a880 100755 --- a/tests/manual/run +++ b/tests/manual/run @@ -2,14 +2,8 @@ CONTAINER=puremourning/vimspector:manual -if [ "$@" ];then - CMD="$@" -else - CMD="bash -l" -fi - docker run --cap-add=SYS_PTRACE \ --security-opt seccomp=unconfined \ --mount src="$(pwd)/../..",target=/home/dev/vimspector,type=bind \ -it ${CONTAINER} \ - $CMD + "$@" From 932b1f57c3516d6101dea65656818ebede1fa33b Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 1 Aug 2019 23:58:27 +0100 Subject: [PATCH 5/9] Revert .bashrc --- tests/ci/image/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ci/image/Dockerfile b/tests/ci/image/Dockerfile index d05c124..8638fa9 100644 --- a/tests/ci/image/Dockerfile +++ b/tests/ci/image/Dockerfile @@ -47,7 +47,7 @@ RUN mkdir -p /home/linuxbrew/.linuxbrew &&\ git clone https://github.com/Homebrew/brew /home/linuxbrew/.linuxbrew/Homebrew && \ ln -s /home/linuxbrew/.linuxbrew/Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin && \ echo "eval \$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" \ - > /etc/skel/.bashrc + > /etc/bash.bashrc RUN /home/linuxbrew/.linuxbrew/bin/brew install golang From dbebb1f1545e981b709dbba61a58a969cc9e082a Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Fri, 2 Aug 2019 00:06:37 +0100 Subject: [PATCH 6/9] Fix vim in docker image --- tests/ci/image/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/ci/image/Dockerfile b/tests/ci/image/Dockerfile index 8638fa9..171b752 100644 --- a/tests/ci/image/Dockerfile +++ b/tests/ci/image/Dockerfile @@ -38,7 +38,8 @@ RUN mkdir -p $HOME/vim && \ git clone https://github.com/vim/vim && \ cd vim && \ git checkout ${VIM_VERSION} && \ - make -j 4 install + make -j 4 && \ + make install # linuxbrew (homebrew) RUN mkdir -p /home/linuxbrew/.linuxbrew &&\ @@ -53,4 +54,5 @@ RUN /home/linuxbrew/.linuxbrew/bin/brew install golang # clean up RUN /home/linuxbrew/.linuxbrew/bin/brew cleanup && \ - rm -rf ~/.cache + rm -rf ~/.cache && \ + rm -rf $HOME/vim From 1da94177df4dee9e4f7e45d29aed782d1ef41728 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sat, 3 Aug 2019 22:02:41 +0100 Subject: [PATCH 7/9] Install node --- azure-pipelines.yml | 4 ++-- tests/ci/image/Dockerfile | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7b29132..989abf5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -65,8 +65,8 @@ stages: pool: vmImage: 'macOS-10.13' steps: - - bash: brew install macvim - displayName: 'Install vim' + - bash: brew unlink node@6 && brew install macvim node + displayName: 'Install vim and node' - bash: go get -u github.com/go-delve/delve/cmd/dlv displayName: 'Install Delve for Go' diff --git a/tests/ci/image/Dockerfile b/tests/ci/image/Dockerfile index 171b752..280d179 100644 --- a/tests/ci/image/Dockerfile +++ b/tests/ci/image/Dockerfile @@ -16,7 +16,8 @@ RUN apt-get update && \ tcllib \ gdb \ lldb \ - curl && \ + curl \ + nodejs && \ apt-get -y autoremove RUN ln -fs /usr/share/zoneinfo/Europe/London /etc/localtime && \ From 3cc78d5562a7fa2f206488e7c60b66ecdd327700 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sat, 3 Aug 2019 22:06:43 +0100 Subject: [PATCH 8/9] Activate linuxbrew for the tests --- azure-pipelines.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 989abf5..5f256e0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -48,7 +48,9 @@ stages: - bash: vim --version displayName: 'Print vim version information' - - bash: ./run_tests + - bash: | + eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + ./run_tests displayName: 'Run the tests' env: VIMSPECTOR_MIMODE: gdb From 938e67c7e2414c83f219a13fb3367d0bfb46272d Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sat, 3 Aug 2019 22:10:38 +0100 Subject: [PATCH 9/9] Apparently undefined is not a real GOPATH --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5f256e0..d7b088c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -50,6 +50,7 @@ stages: - bash: | eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) + export GOPATH=$HOME/go ./run_tests displayName: 'Run the tests' env: