Commit Graph

109 Commits

Author SHA1 Message Date
Florian Walch
9376b3db4b Improve legacy2luatest script. 2014-11-09 15:06:03 +01:00
Florian Walch
bc6ac59928 Add legacy test conversion script. 2014-11-04 11:38:06 -03:00
Thiago de Arruda
64844b7312 msgpack-rpc: Improve logging of msgpack-rpc messages
- Expose more logging control from the log.c module(get log stream and omit
  newlines)
- Remove logging from the generated functions in msgpack-gen.lua
- Refactor channel.c/helpers.c to log every msgpack-rpc payload using
  msgpack_object_print(a helper function from msgpack.h)
- Remove the api_stringify function, it was only useful for logging msgpack-rpc
  which is now handled by msgpack_object_print.
2014-10-23 21:46:03 -03:00
Thiago de Arruda
b31a74ad11 debug: Improve debugging of msgpack-rpc requests
- Add the api_stringify function to display API objects
- Use api_stringify to display request arguments and return values in DLOG
  statements.
2014-10-22 11:26:43 -03:00
Thiago de Arruda
4233446344 debug: Fix broken DLOG macro calls 2014-10-22 11:26:43 -03:00
Thiago de Arruda
72e3e57bf1 msgpack-rpc: Allow selective deferral API calls
Since all API functions now run immediately after a msgpack-rpc request is
parsed by libuv callbacks, a mechanism was added to override this behavior and
allow certain functions to run in Nvim main loop.

The mechanism is simple: Any API function tagged with the FUNC_ATTR_DEFERRED (a
"dummy" attribute only used by msgpack-gen.lua) will be called when Nvim main
loop receives a K_EVENT key.

To implement this mechanism it was necessary some restructuration on the
msgpack-rpc modules, especially in the msgpack-gen.lua script.
2014-10-21 11:05:49 -03:00
Thiago de Arruda
b280308ac6 msgpack-rpc: Create subdirectory for msgpack-rpc modules
Create the msgpack_rpc subdirectory and move all modules that deal with
msgpack-rpc to it. Also merge msgpack_rpc.c into msgpack_rpc/helpers.c
2014-10-21 11:05:49 -03:00
Thiago de Arruda
69561ea922 test: Remove run-functional-tests.py
Now that the lua client is available, python/lupa are no longer necessary to run
the functional tests. The helper functions previously defined in
run-functional-tests.py were adapted to test/functional/helpers.lua.
2014-10-16 09:21:37 -03:00
Thiago de Arruda
f6a008a182 test: Add 'eval' functional helper
The eval helper transforms vimL expressions into lua tables, it's useful for
verifying function output.
2014-10-01 09:31:57 -03:00
Thiago de Arruda
42d5b526b9 test: Replace vroom by lua/busted for functional tests
The 'lupa' python package provides a simple way to seamless integrate lua and
python code.

This commit replaces vroom by a python script that exposes the 'neovim' package
to a lua state, and invokes busted to run functional tests. This is a temporary
solution that will enable writing functional tests using lua/bused while a lua
client library is not available.

The reason for dropping vroom is flexibility: Lua/busted has a nice DSL-style
syntax while also providing the customization power of a full programming
language. Another reason is to use a single framework for unit/functional tests.

Two other changes were performed in this commit:

- Instead of "gcc-unittest/gcc-ia32", the travis builds for gcc are now
  identified by "gcc/gcc-32". They will run unit/functional tests for both 64
  and 32 bits.
- Old integration tests(in src/nvim/testdir) are now ran by the 'oldtest' target
2014-09-30 17:37:16 -03:00
Thiago de Arruda
ddecfb763b deps: Switch lua msgpack library to one that supports 2.0 2014-09-16 14:14:00 -03:00
Thiago de Arruda
31f835adc4 msgpack-gen: Fix msgpack_rpc_init_function_metadata
The function was broken on release builds
2014-09-16 14:14:00 -03:00
Thiago de Arruda
2d1b5589e8 server: Rename address environment variable
To follow the pattern of using NVIM for technical descriptions, it was renamed
to NVIM_LISTEN_ADDRESS
2014-09-13 21:35:47 -03:00
Thiago de Arruda
545acf2024 api metadata: Allow typed container information in api functions
Adapt gendeclarations.lua/msgpack-gen.lua to allow the `ArrayOf(...)` and
`DictionaryOf(...)` types in function headers. These are simple macros that
expand to Array and Dictionary respectively, but the information is kept in the
metadata object, which is useful for building clients in statically typed
languages.
2014-09-12 13:50:07 -03:00
Thiago de Arruda
cd2e46c078 api/msgpack-rpc: Refactor metadata object construction
Instead of building all metadata from msgpack-gen.lua, we now merge the
generated part with manual information(such as types and features). The metadata
is accessible through the api method `vim_get_api_info`.

This was done to simplify the generator while also increasing flexibility(by
being able to add more metadata)
2014-09-12 13:50:07 -03:00
Thiago de Arruda
cac24cb06d api/msgpack-rpc: Refactor msgpack_rpc_helpers.{c,h}
- Move helpers that are specific to API types to api/private/helpers.{c,h}
- Include headers with generated declarations
- Delete unused macros
2014-09-12 13:25:28 -03:00
Thiago de Arruda
2f566c83d9 api/msgpack-rpc: Parse type information from api/private/defs.h
Enhance msgpack-gen.lua to extract custom api type codes from the ObjectType
enum in api/private/defs.h. The type information is made available from the api
metadata and clients can use to correctly serialize/deserialize these types
using msgpack EXT type.
2014-09-12 13:25:28 -03:00
Thiago de Arruda
d5e3cede28 msgpack-rpc: Remove support for integer ids in methods
There's no need to have integer and string ids, and since we now fully support
msgpack-RPC, support for integer ids was removed.
2014-09-12 13:25:28 -03:00
Thiago de Arruda
cd70b9c015 msgpack-rpc: Refactor API metadata discovery method
A new method is now exposed via msgpack-rpc: "get_api_metadata". This method has
the same job as the old method '0', it returns an object with API metadata for
use by generators.

There's one difference in the return value though: instead of returning a
string containing another serialized msgpack document, the metadata object is
returned directly(a separate deserialization step by clients is not required).
2014-09-12 13:25:28 -03:00
Thiago de Arruda
19bc29ee83 msgpack-rpc: Move handle_missing_method to msgpack_rpc.c
Since that function is not automatically generated, it's best to place it in a
normal C module
2014-09-12 13:25:28 -03:00
Thiago de Arruda
74aff19691 msgpack-rpc: Refactor initializer and dispatcher
Use Map(String, rpc_method_handler_fn) for storing/retrieving rpc method
handlers in msgpack_rpc_init and msgpack_rpc_dispatch.

Also refactor serialization/validation functions in the
msgpack_rpc.c/msgpack_rpc_helpers.c modules to accept the new STR and BIN types.
2014-09-12 13:25:28 -03:00
Thiago de Arruda
c39ae3e4d4 map/msgpack-rpc: Declare/define maps rpc method handlers
The new map type uses `String` instances as keys to avoid unnecessary copying to
zero-terminated buffers.
2014-09-12 13:25:28 -03:00
Thiago de Arruda
e2143674ae deps: Update to the experimental msgpack v5 branch
Using msgpack v5 will let nvim be more compatible with msgpack libraries for
other platforms.

This also replaces "raw" references by "bin" which is the new name for msgpack
binary data type
2014-09-12 13:19:50 -03:00
Thiago de Arruda
aa23d2f835 msgpack-rpc: Accept method names in requests 2014-08-29 22:08:58 -03:00
Thiago de Arruda
b744073fae test: Remove cleanup function definition from run-api-tests.exp
This function is now injected automatically when running the python-client tests
2014-08-28 14:07:31 -03:00
ZyX
1e11de5385 Fix problem with test47: addition is not bitwise OR
:diffsplit command used to include some flag value twice. If I was using bitwise
OR it would be OK, but I had addition here. Changed to use bitwise OR.
2014-08-20 20:21:37 +04:00
ZyX
b8a32b6603 Add const qualifier and explicit length 2014-08-20 20:21:37 +04:00
ZyX
3becb5fd21 Use lua generator in place of ex_cmds_defs header trick
Closes #788
Fixes #379
Ref #549
2014-08-20 20:21:37 +04:00
Thiago de Arruda
6483a198e4 Travis CI: Refactor travis script
To simplify modification/inclusion of continuous integration targets, this
removes travis.sh which contains a big if statement in favor of multiple scripts
under the new '.ci' directory.
2014-08-08 06:06:10 -04:00
ZyX
1fa3a7d70a Use color_terminal output in place of TAP #995 2014-08-07 02:07:08 -04:00
Florian Walch
f29504a5b8 travis.sh: Update sources before installing packages. 2014-08-06 12:58:38 -03:00
Thiago de Arruda
4dc642aa62 api tests: set 'initpython' in BeforeEachTest
This is required to run some tests of the python client
2014-07-17 11:37:42 -03:00
Thiago de Arruda
cf30837951 api/events/msgpack: Insert log statements to improve debugging
Also changed the default log level to INFO so developers won't end up with big
log files without asking explicitly(DLOG statements were placed in really "hot"
code)
2014-07-17 11:37:41 -03:00
John Szakmeister
1172e25fad travis.sh: move symbolizer definition into common area 2014-07-17 05:30:20 -04:00
Florian Walch
5433694db3 travis.sh: Simplify clang/asan build.
* Clang 3.4 now default on Travis CI.
* Introduce config variable to download & use different clang version.
2014-07-16 06:01:02 -04:00
Florian Walch
2cae6919dc travis.sh: Use dependencies from neovim/deps. 2014-07-16 06:01:02 -04:00
Florian Walch
58e85fca02 travis.sh: Fix mixed tabs/whitespace formatting. 2014-07-16 06:01:02 -04:00
Brandon Coleman
e69cfa6c15 move assert.h include out of vim.h 2014-07-09 00:18:19 +02:00
Thiago de Arruda
745928ef6b dispatch function generator: Fix bug in validation/initialization
- Initialize variables before validating argument count to remove possibility of
  freeing uninitialized pointers
- Set the error when the argument count validation fails
2014-07-07 12:18:39 -03:00
Felipe Oliveira Carvalho
9a2b2d4a64 MsgPack-RPC dispatch based on function array lookup #864
This simplifies the generated msgpack_rpc_dispatch() function, separates the
code for each RPC method more clearly and allows easy implementation of
alternative dispatching methods (e.g. string method id dispatch).
2014-07-04 17:05:24 +00:00
John Szakmeister
b235793dac Fix #838: build with "USE_BUNDLED=OFF" fails to find dependencies
Stop forcing some platform setting that are really intended to be used
for Travis CI.  Under other systems, like Arch Linux, it prevents
dependencies from being correctly located.
2014-06-27 06:52:59 -04:00
Thiago de Arruda
296da85198 channel/msgpack_rpc: Refactor API dispatching
This is how API dispatching worked before this commit:

- The generated `msgpack_rpc_dispatch` function receives a the `msgpack_packer`
  argument.
- The response is incrementally built while validating/calling the API.
- Return values/errors are also packed into the `msgpack_packer` while the
  final response is being calculated.

Now the `msgpack_packer` argument is no longer provided, and the
`msgpack_rpc_dispatch` function returns `Object`/`Error` values to
`msgpack_rpc_call`, which will use those values to build the response in a
single pass.

This was done because the new `channel_send_call` function created the
possibility of having recursive API invocations, and this wasn't possible when
sharing a single `msgpack_sbuffer` across call frames(it was shared implicitly
through the `msgpack_packer` instance).

Since we only start to build the response when the necessary information has
been computed, it's now safe to share a single `msgpack_sbuffer` instance
across all channels and API invocations.

Some other changes also had to be performed:

- Handling of the metadata discover was moved to `msgpack_rpc_call`
- Expose more types as subtypes of `Object`, this was required to forward the
  return value from `msgpack_rpc_dispatch` to `msgpack_rpc_call`
- Added more helper macros for casting API types to `Object`
  any
2014-06-24 13:02:24 -03:00
Thiago de Arruda
bc0380038e channel/msgpack_rpc: Refactor to better split functions across modules
Move validation/conversion functions and to msgpack_rpc_helpers to separate
those from the functions that are used from the channel module
2014-06-24 13:02:24 -03:00
ZyX
b0641510b6 Avoid ever creating .deps directory
Thanks to @jszakmeister this uses make own features.
2014-06-18 16:21:11 -04:00
Thiago de Arruda
72907c34f4 build: increase timeout for run-api-tests.exp 2014-06-18 11:36:07 -03:00
Thiago de Arruda
796ea333d4 build: Fix error in dispatch generator for functions with channel_id 2014-06-18 11:36:07 -03:00
Thiago de Arruda
4b787fb7d1 Make gendeclarations.lua more friendly to incremental builds
Modify gendeclarations.lua to check if the generated non-static declaration
header changed before rewriting it with a new version. This is to prevent
unnecessary rebuilds of modules that depend on modules that had private changes.
2014-06-02 15:53:55 -03:00
ZyX
6498b281fa Remove remaining declarations with new script: finddeclarations.pl 2014-06-02 11:04:18 -03:00
ZyX
70929f7e16 Add automatic generation of headers
- The 'stripdecls.py' script replaces declarations in all headers by includes to
  generated headers.
  `ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'`
  was used for this.
- Add and integrate gendeclarations.lua into the build system to generate the
  required includes.
- Add -Wno-unused-function
- Made a bunch of old-style definitions ANSI

This adds a requirement: all type and structure definitions must be present
before INCLUDE_GENERATED_DECLARATIONS-protected include.

Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is
the only exception.
2014-06-02 11:04:17 -03:00
ZyX
880957ad4e Move documentation from function declarations to definitions
Uses a perl script to move it (scripts/movedocs.pl)
2014-06-02 11:04:04 -03:00