From 205e8e4bcfca00123992f096c25a4d284346a6e4 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 31 Oct 2023 13:27:39 +0100 Subject: [PATCH 1/7] ci: add optional CI that can be triggered manually These are meant for expensive or situational tests that may not be suitable to run each time, but can occasionally be useful. Currently only add testing for s390x. The job is enabled by adding the ci-s390x label in github. (cherry picked from commit 20dd9f3a26e45a1b4c95ba33d6c9f300184fc361) --- .github/workflows/optional.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/optional.yml diff --git a/.github/workflows/optional.yml b/.github/workflows/optional.yml new file mode 100644 index 0000000000..f512bb0d2a --- /dev/null +++ b/.github/workflows/optional.yml @@ -0,0 +1,34 @@ +name: optional +on: + pull_request: + types: [labeled, opened, synchronize, reopened] + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +jobs: + s390x: + if: ${{ github.event.label.name == 'ci-s390x' }} + strategy: + fail-fast: false + matrix: + test: [functionaltest, oldtest] + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset + - uses: docker://multiarch/ubuntu-core:s390x-focal + with: + args: > + bash -c + " + apt-get -y update && + DEBIAN_FRONTEND=noninteractive apt-get -y install attr build-essential cmake curl gettext libattr1-dev ninja-build unzip locales-all cpanminus git && + git clone --depth=1 https://github.com/neovim/neovim.git && + cd neovim && + cmake -S cmake.deps -B .deps -G Ninja -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON && + cmake --build .deps && + cmake -B build -G Ninja -D PREFER_LUA=ON && + make ${{ matrix.test }} + " From 56775637438515209c1a5b5e32cdbd0d1bc2662d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 22 Oct 2023 13:30:32 +0200 Subject: [PATCH 2/7] ci: various fixes - install attr only when tesitng - fix s390x workflow by checking out the merge PR instead of master (cherry picked from commit 9ad239690fe6b151afe2f43c2858d68a2b877e1d) --- .github/workflows/optional.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/optional.yml b/.github/workflows/optional.yml index f512bb0d2a..f3bb27dc70 100644 --- a/.github/workflows/optional.yml +++ b/.github/workflows/optional.yml @@ -7,9 +7,14 @@ concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} cancel-in-progress: true +env: + INSTALL_PREFIX: ${{ github.workspace }}/nvim-install + # TEST_FILE: test/functional/shada + # TEST_FILTER: foo + jobs: s390x: - if: ${{ github.event.label.name == 'ci-s390x' }} + if: contains(github.event.pull_request.labels.*.name, 'ci-s390x') strategy: fail-fast: false matrix: @@ -24,9 +29,11 @@ jobs: bash -c " apt-get -y update && - DEBIAN_FRONTEND=noninteractive apt-get -y install attr build-essential cmake curl gettext libattr1-dev ninja-build unzip locales-all cpanminus git && + DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake curl gettext ninja-build unzip locales-all cpanminus git attr libattr1-dev && git clone --depth=1 https://github.com/neovim/neovim.git && cd neovim && + git fetch origin ${{ github.ref }}:pr && + git switch pr && cmake -S cmake.deps -B .deps -G Ninja -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON && cmake --build .deps && cmake -B build -G Ninja -D PREFER_LUA=ON && From 0abb96f55412448512201ba467b19eafd4865bc1 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 18 Dec 2023 17:46:25 -0500 Subject: [PATCH 3/7] ci(s390x): double TEST_TIMEOUT since tests are running via qemu (cherry picked from commit 1beef6cd21acff0c7ef083dc90f768689dceb7ca) --- .github/workflows/optional.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/optional.yml b/.github/workflows/optional.yml index f3bb27dc70..60272afa63 100644 --- a/.github/workflows/optional.yml +++ b/.github/workflows/optional.yml @@ -9,6 +9,8 @@ concurrency: env: INSTALL_PREFIX: ${{ github.workspace }}/nvim-install + # Double test timeout since it's running via qemu + TEST_TIMEOUT: 2400 # TEST_FILE: test/functional/shada # TEST_FILTER: foo From 150f2b274d5268c2d1afc1d0fc76404e2332d7e8 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 18 Dec 2023 19:02:47 -0500 Subject: [PATCH 4/7] ci(s390x): run build & test as a non-root user (cherry picked from commit 3d8cd0c5d3ac10f13921d3c6adca1f6cf29668d2) --- .github/workflows/optional.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/optional.yml b/.github/workflows/optional.yml index 60272afa63..d2002bd674 100644 --- a/.github/workflows/optional.yml +++ b/.github/workflows/optional.yml @@ -27,17 +27,21 @@ jobs: - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset - uses: docker://multiarch/ubuntu-core:s390x-focal with: + # Docker runs the command as root, but we want the build/test to run + # as non-root so permissions based tests run correctly args: > bash -c " apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake curl gettext ninja-build unzip locales-all cpanminus git attr libattr1-dev && - git clone --depth=1 https://github.com/neovim/neovim.git && + useradd --create-home qemuci && + chown -R qemuci. . && + runuser -u qemuci -- git clone --depth=1 https://github.com/neovim/neovim.git && cd neovim && - git fetch origin ${{ github.ref }}:pr && - git switch pr && - cmake -S cmake.deps -B .deps -G Ninja -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON && - cmake --build .deps && - cmake -B build -G Ninja -D PREFER_LUA=ON && - make ${{ matrix.test }} + runuser -u qemuci -- git fetch origin ${{ github.ref }}:pr && + runuser -u qemuci -- git switch pr && + runuser -u qemuci -- cmake -S cmake.deps -B .deps -G Ninja -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON && + runuser -u qemuci -- cmake --build .deps && + runuser -u qemuci -- cmake -B build -G Ninja -D PREFER_LUA=ON && + runuser -u qemuci -- make ${{ matrix.test }} " From 92d620ad92bb86454a35e150e34e30cbb04fe56b Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 18 Dec 2023 16:27:02 -0500 Subject: [PATCH 5/7] fix(set_bool_option): use int value to make bool Object Boolean options are stored in an int, not a char, so dereferencing "char *varp" is not portable to big-endian systems. --- src/nvim/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/option.c b/src/nvim/option.c index 4658ca4a3a..44a4ec2843 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2248,7 +2248,7 @@ static const char *set_bool_option(const int opt_idx, char *const varp, const in if (options[opt_idx].flags & P_UI_OPTION) { ui_call_option_set(cstr_as_string(options[opt_idx].fullname), - BOOLEAN_OBJ(*varp)); + BOOLEAN_OBJ(*(int *)varp)); } if ((int *)varp == &p_ru || (int *)varp == &p_sc) { // in case 'ruler' or 'showcmd' changed From ad8bd452075f1f4b31eaee393d49455ec852a0b6 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 18 Dec 2023 17:22:57 -0500 Subject: [PATCH 6/7] fix(set_option_from_tv): use v_bool to access boolean option --- src/nvim/eval/vars.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index 9120cc4471..09a5560d2b 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -1644,7 +1644,7 @@ static void set_option_from_tv(const char *varname, typval_T *varp) emsg(_(e_stringreq)); return; } - numval = (long)varp->vval.v_number; + numval = varp->vval.v_bool; strval = "0"; // avoid using "false" } else { numval = (long)tv_get_number_chk(varp, &error); From 13f8bc4257bcec05054524257b185705eab9c878 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 18 Dec 2023 17:38:24 -0500 Subject: [PATCH 7/7] fix(extmark_to_array): convert conceal_char to bytes conceal_char is the codepoint of the character. Using it directly as the string isn't valid if the character is non-ascii or on big-endian systems. --- src/nvim/api/extmark.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index eb49587d03..1b4d805d87 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -222,7 +222,9 @@ static Array extmark_to_array(const ExtmarkInfo *extmark, bool id, bool add_dict } if (decor->conceal) { - String name = cstr_to_string((char *)&decor->conceal_char); + char bytes[MB_MAXCHAR + 1] = {0}; + utf_char2bytes(decor->conceal_char, bytes); + String name = cstr_to_string(bytes); PUT(dict, "conceal", STRING_OBJ(name)); }