test: move oldtests to test directory (#22536)

The new oldtest directory is in test/old/testdir. The reason for this is
that many tests have hardcoded the parent directory name to be
'testdir'.
This commit is contained in:
dundargoc 2023-03-07 04:13:04 +01:00 committed by GitHub
parent bf4eada2c8
commit af23d17388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
267 changed files with 30 additions and 28 deletions

2
.gitattributes vendored
View File

@ -8,6 +8,4 @@ src/xdiff/** linguist-vendored
src/cjson/** linguist-vendored src/cjson/** linguist-vendored
src/unicode/** linguist-vendored src/unicode/** linguist-vendored
src/nvim/testdir/test42.in diff
.github/ export-ignore .github/ export-ignore

View File

@ -366,5 +366,5 @@ jobs:
# But would break functionaltest, where its `more` would be used then. # But would break functionaltest, where its `more` would be used then.
$OldPath = $env:PATH $OldPath = $env:PATH
$env:PATH = "C:\msys64\usr\bin;$env:PATH" $env:PATH = "C:\msys64\usr\bin;$env:PATH"
& "C:\msys64\mingw64\bin\mingw32-make.exe" -C $(Convert-Path src\nvim\testdir) VERBOSE=1 & "C:\msys64\mingw64\bin\mingw32-make.exe" -C $(Convert-Path test\old\testdir) VERBOSE=1
$env:PATH = $OldPath $env:PATH = $OldPath

26
.gitignore vendored
View File

@ -36,21 +36,21 @@ compile_commands.json
*.rej *.rej
# Generated by old (Vim) tests. # Generated by old (Vim) tests.
/src/nvim/testdir/del /test/old/testdir/testdir/del
/src/nvim/testdir/test*.out /test/old/testdir/testdir/test*.out
/src/nvim/testdir/test*.res /test/old/testdir/testdir/test*.res
/src/nvim/testdir/test*.log /test/old/testdir/testdir/test*.log
/src/nvim/testdir/messages /test/old/testdir/testdir/messages
/src/nvim/testdir/viminfo /test/old/testdir/testdir/viminfo
/src/nvim/testdir/test.ok /test/old/testdir/testdir/test.ok
/src/nvim/testdir/*.failed /test/old/testdir/testdir/*.failed
/src/nvim/testdir/X* /test/old/testdir/testdir/X*
/src/nvim/testdir/valgrind.* /test/old/testdir/testdir/valgrind.*
/src/nvim/testdir/.gdbinit /test/old/testdir/testdir/.gdbinit
/runtime/indent/testdir/*.out /runtime/indent/testdir/*.out
+runtime/indent/testdir/*.fail +runtime/indent/testdir/*.fail
# Generated by src/nvim/testdir/runnvim.sh. # Generated by test/old/testdir/testdir/runnvim.sh.
/src/nvim/testdir/*.tlog /test/old/testdir/testdir/*.tlog
# Generated by unit tests. # Generated by unit tests.
/test/includes/post/ /test/includes/post/

View File

@ -113,17 +113,17 @@ build/.ran-deps-cmake::
# TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag. # TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag.
oldtest: | nvim build/runtime/doc/tags oldtest: | nvim build/runtime/doc/tags
+$(SINGLE_MAKE) -C src/nvim/testdir clean +$(SINGLE_MAKE) -C test/old/testdir clean
ifeq ($(strip $(TEST_FILE)),) ifeq ($(strip $(TEST_FILE)),)
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG=$(NVIM_PRG) $(MAKEOVERRIDES) +$(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) $(MAKEOVERRIDES)
else else
@# Handle TEST_FILE=test_foo{,.res,.vim}. @# Handle TEST_FILE=test_foo{,.res,.vim}.
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst %.vim,%,$(patsubst %.res,%,$(TEST_FILE))) +$(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst %.vim,%,$(patsubst %.res,%,$(TEST_FILE)))
endif endif
# Build oldtest by specifying the relative .vim filename. # Build oldtest by specifying the relative .vim filename.
.PHONY: phony_force .PHONY: phony_force
src/nvim/testdir/%.vim: phony_force test/old/testdir/%.vim: phony_force
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst src/nvim/testdir/%.vim,%,$@) +$(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst test/old/testdir/%.vim,%,$@)
functionaltest-lua: | nvim functionaltest-lua: | nvim
$(BUILD_TOOL) -C build $@ $(BUILD_TOOL) -C build $@
@ -143,7 +143,7 @@ iwyu: build/.ran-cmake
clean: clean:
+test -d build && $(BUILD_TOOL) -C build clean || true +test -d build && $(BUILD_TOOL) -C build clean || true
$(MAKE) -C src/nvim/testdir clean $(MAKE) -C test/old/testdir clean
$(MAKE) -C runtime/indent clean $(MAKE) -C runtime/indent clean
distclean: distclean:

View File

@ -226,6 +226,10 @@ preprocess_patch() {
local na_vimrcexample='vimrc_example\.vim' local na_vimrcexample='vimrc_example\.vim'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/\<\%('${na_vimrcexample}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/\<\%('${na_vimrcexample}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Rename src/testdir/ paths to test/old/testdir/
LC_ALL=C sed -e 's/\( [ab]\)\/src\/testdir/\1\/test\/old\/testdir/g' \
"$file" > "$file".tmp && mv "$file".tmp "$file"
# Rename src/ paths to src/nvim/ # Rename src/ paths to src/nvim/
LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g' \ LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g' \
"$file" > "$file".tmp && mv "$file".tmp "$file" "$file" > "$file".tmp && mv "$file".tmp "$file"

View File

@ -3,7 +3,7 @@ Tests
Tests are broadly divided into *unit tests* ([test/unit](https://github.com/neovim/neovim/tree/master/test/unit/)), Tests are broadly divided into *unit tests* ([test/unit](https://github.com/neovim/neovim/tree/master/test/unit/)),
*functional tests* ([test/functional](https://github.com/neovim/neovim/tree/master/test/functional/)), *functional tests* ([test/functional](https://github.com/neovim/neovim/tree/master/test/functional/)),
and *old tests* ([src/nvim/testdir/](https://github.com/neovim/neovim/tree/master/src/nvim/testdir/)). and *old tests* ([test/old/testdir/](https://github.com/neovim/neovim/tree/master/test/old/testdir/)).
- _Unit_ testing is achieved by compiling the tests as a shared library which is - _Unit_ testing is achieved by compiling the tests as a shared library which is
loaded and called by [LuaJit FFI](http://luajit.org/ext_ffi.html). loaded and called by [LuaJit FFI](http://luajit.org/ext_ffi.html).
@ -48,7 +48,7 @@ Layout
- `/test/*/**/*_spec.lua` : actual tests. Files that do not end with - `/test/*/**/*_spec.lua` : actual tests. Files that do not end with
`_spec.lua` are libraries like `/test/**/helpers.lua`, except that they have `_spec.lua` are libraries like `/test/**/helpers.lua`, except that they have
some common topic. some common topic.
- `/src/nvim/testdir` : old tests (from Vim) - `/test/old/testdir` : old tests (from Vim)
Running tests Running tests
@ -83,7 +83,7 @@ To run a *single* legacy test file you can use either:
or: or:
make src/nvim/testdir/test_syntax.vim make test/old/testdir/test_syntax.vim
- Specify only the test file name, not the full path. - Specify only the test file name, not the full path.

View File

@ -7,7 +7,7 @@ local clear, command = helpers.clear, helpers.command
-- Temporary file for gathering benchmarking results for each regexp engine. -- Temporary file for gathering benchmarking results for each regexp engine.
local result_file = 'benchmark.out' local result_file = 'benchmark.out'
-- Fixture containing an HTML fragment that can make a search appear to freeze. -- Fixture containing an HTML fragment that can make a search appear to freeze.
local sample_file = 'src/nvim/testdir/samples/re.freeze.txt' local sample_file = 'test/old/testdir/samples/re.freeze.txt'
-- Vim script code that does both the work and the benchmarking of that work. -- Vim script code that does both the work and the benchmarking of that work.
local measure_cmd = local measure_cmd =

View File

@ -898,7 +898,7 @@ local load_factor = 1
if global_helpers.is_ci() then if global_helpers.is_ci() then
-- Compute load factor only once (but outside of any tests). -- Compute load factor only once (but outside of any tests).
module.clear() module.clear()
module.request('nvim_command', 'source src/nvim/testdir/load.vim') module.request('nvim_command', 'source test/old/testdir/load.vim')
load_factor = module.request('nvim_eval', 'g:test_load_factor') load_factor = module.request('nvim_eval', 'g:test_load_factor')
end end
function module.load_adjust(num) function module.load_adjust(num)

View File

@ -1,4 +1,4 @@
-- See also: src/nvim/testdir/test_options.vim -- See also: test/old/testdir/test_options.vim
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local command, clear = helpers.command, helpers.clear local command, clear = helpers.command, helpers.clear
local source, expect = helpers.source, helpers.expect local source, expect = helpers.source, helpers.expect

Some files were not shown because too many files have changed in this diff Show More