Commit Graph

572 Commits

Author SHA1 Message Date
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
Rui Abreu Ferreira
1971cc30b5 Add --api-metadata command line option
- New command line option prints the binary API metadata object
  and exits
2014-06-02 10:34:51 -03:00
John Szakmeister
7e797067df Make it easier to turn the bundled dependencies off. 2014-05-31 13:15:56 -04:00
Nicolas Hillegeer
cd457b72ec travis/coverity: hotfix #2, unbreak build
I hadn't spotted that the `sh -e` commandline was being used. I *think* this
is what's causing the exit 0 line not to run. Pray for success.

It's a real shame I can't this locally, what a mess.
2014-05-31 16:57:42 +02:00
Nicolas Hillegeer
9d60365e99 travis/coverity: hotfix, alwasy return success
It seems the coverity script likes to return 1 (error) when the current
branch does not follow its pattern. Temporarily disable that.
2014-05-31 16:48:51 +02:00
Nicolas Hillegeer
7f9caaf30d travis/coverity: add coverity support
Run only on push to branch coverity-scan. We can use a cron script to do
this 4 times a week (that's our allowance).

NOTE: possible future improvements are:

1. Fold the build matrix item into another short one so we don't overburden
   travis. It's a little less clear but it should be nicer on the
   infrastructure.
2. Change the security token, one can do that from the coverity admin page.
3. Don't do the naive `make depend`, but use the prebuilt libraries.
2014-05-31 16:41:23 +02:00
John Szakmeister
a581173e71 Turn off -Werror by default.
It inteferes with development activities by breaking your build in the
middle of a refactor.  Instead, let's enable -Werror on the Travis CI
builds via a TRAVIS_CI_BUILD option.
2014-05-29 17:37:12 -04:00
Thiago de Arruda
a001b8cb0c Build: Fix autocmd removal from cleanup function 2014-05-28 08:52:54 -03:00
Thiago de Arruda
6b006dd7a2 API: Events: Automatically pass channel ids to API functions
The dispatch function generator was customized to allow for API functions to
declare a 'channel_id' as first argument.
2014-05-28 08:52:54 -03:00
Thiago de Arruda
a80a68c927 Build: Enable valgrind's --leak-check when testing the API 2014-05-26 14:02:12 -03:00
Thiago de Arruda
139c7ffdc7 API: Events: Return channel id from the API discover request
This refactors msgapck_rpc_{dipatch,call} to receive the channel id as
argument. Now the discovery request returns the [id, metadata] array.
2014-05-26 14:02:12 -03:00
Thiago de Arruda
6c96e42e2c API: Test: Setup basic test infrastructure
- Add a 'expect' utility script that can run simple API tests using clients
  developed for any platform.
- Extend travis build matrix to run API tests using the python client and
  valgrind.

This script can be used to write API tests without having to manage nvim's
lifetime:

- It starts a single nvim instance listening on a known socket
- Invokes the test runner, which should connect to NEOVIM_LISTEN_ADDRESS
- The nvim instance started by the script provides a `BeforeEachTest` function,
  which should be called before each test to reset nvim to a clean state.
- It takes care of shutting down nvim once the tests are finished.

As explained
[here](https://github.com/neovim/neovim/pull/737#issuecomment-43941520), it's
not possible to fully reset nvim to it's initial state, but the `BeforeEachTest`
function should be enough for most test cases. Tests requiring a fully clean
nvim instance should take care of starting/stopping nvim.
2014-05-23 16:06:59 -03:00
Thiago de Arruda
32b6122460 Remove hardcoded type names from msgpack-gen.lua
Except for the `Error *` type, all parameter types are valid identifiers, so
reuse that LPeg rule.
2014-05-17 08:05:44 -03:00
Eliseo Martínez
a6734844ca Introduce nvim namespace: Fix build process.
- Leave src as include dir (for includes to recognize 'nvim/' prefix).
- Change subdirectory from src to src/nvim.
- Fix msgpack generation.
- Fix some other paths to new locations.
2014-05-15 20:46:01 +02:00
Thiago de Arruda
b3268d0712 Refactor API types and prototypes
- Split functions with multiple files in the 'api' subdirectory
- Move/Add more types in the 'api/defs.h' header
- Add more prototypes
- Refactor scripts/msgpack-gen.lua
- Move msgpack modules to 'os' subdirectory
2014-05-12 19:28:30 -03:00
Justin M. Keyes
973baa2a06 coveralls upload should not fail the CI build
- swallow error code
2014-05-07 13:50:30 -04:00
Leonard Ehrenfried
42939d7648 Hold java packages to speed up build 2014-04-28 09:27:58 -03:00
Steven Myint
c70a526a5d Remove deprecated "--use-mirrors"
In newer versions of `pip`, it is obsolete. See the following relevant links.

https://pip.readthedocs.org/en/latest/news.html
https://github.com/eddyxu/cpp-coveralls/pull/37
2014-04-26 08:48:30 -04:00
John Szakmeister
8c5f3aebc8 Install the libncurses5-dev:i386 package to get the correct symlinks. 2014-04-23 10:45:31 -03:00
Thiago de Arruda
8f710a4103 Fix clint.sh wrapper script and broken files
- Fixed clint.sh, it no longer ignores errors in individual files.
- Fixed two files that weren't passing the clint test
2014-04-22 21:56:06 -03:00
Thiago de Arruda
9f7426ca16 Configure travis to perform a 32-bit build
- Build targeting 32-bit with travis
- Code in `before_install`/`after_success` was moved to travis.sh since it
  provides greater flexibility for detecting the build matrix environment. This
  improves the build speed since we now install only what's necessary.
- Now clint has a dedicated travis worker
2014-04-22 21:55:59 -03:00
Thiago de Arruda
937922271a Configure travis to use prebuilt dependencies
Dependencies are now hosted in a github repository and this brings two advantages:

- Improved build time with travis since we no longer have to build each
  dependency
- Less chance of build errors due to external servers being down since Github is
  now the single point of failure
2014-04-16 19:43:45 -03:00
Thiago de Arruda
35ff53c6b0 Add msgpack_rpc_dispatch/metadata generator
This adds a lua script which parses the contents of 'api.h'. After the api is
parsed into a metadata table. After that, it will generate:

- A msgpack blob for the metadata table. This msgpack object contains everything
  scripting engines need to generate their own wrappers for the remote API.
- The `msgpack_rpc_dispatch` function, which takes care of validating msgpack
  requests, converting arguments to C types and passing control to the
  appropriate 'api.h' function. The result is then serialized back to msgpack
  and returned to the client.

This approach was used because:

- It automatically modifies `msgpack_rpc_dispatch` to reflect API changes.
- Scripting engines that generate remote call wrappers using the msgpack
  metadata will also adapt automatically to API changes
2014-04-11 14:07:45 -03:00
Thiago de Arruda
0805911434 Run clint.py in some files 2014-04-08 13:49:45 -03:00
Thiago de Arruda
23ee78a093 Force travis build failure when some test fails 2014-04-03 10:21:56 -03:00
aph
7fd140b99a enable coveralls support 2014-04-01 08:06:20 -03:00
John Szakmeister
cc9fbd9e55 Use the clang 3.4 release tarball instead of apt for clang 3.4.
It appears the llvm.org/apt/ repository isn't always reliable.  So let's
use the release tarball instead.  Also, make using 3.4 conditional, so
we can use the clang 3.3 if things still manage to go awry in the
future.  Note: using 3.3 means that we won't get leak detection.

I left the logic for using llvm.org/apt/, just in case we want try using
it again sometime.
2014-03-30 21:18:29 -04:00
John Szakmeister
86180787fa Drop the deb-src for clang.
The llvm.org/apt repo currently has an issue with the source packages,
and we don't need it on Travis anyways.
2014-03-29 10:01:18 -04:00
John Szakmeister
e644f8c2b1 Don't use alias in travis.sh.
We don't want to clobber anyone's make alias when running travis.sh
directly.
2014-03-27 14:43:13 -04:00
John Szakmeister
0b2f6a0cf4 Revamp the build system.
This achieves several goals:

 * Less reliance on scripts so we have better portability to Windows
   (though we still have a ways to go for proper Windows support).
   Luajit, luarocks, moonscript, and busted are all installed via CMake
   now.
 * Trying to make use of pkg-config to get the correct libraries.  The
   latest libuv is still broken in this regard, but we'll at least be in
   a position to use it.
 * Allow the use of Ninja or make.  The former runs faster in many
   environments, and automatically makes use of parallel builds.

This also allows for system installed dependencies--though not through
the Makefile just yet--and adds support for FreeBSD.

This also make us build libuv and luajit as static libraries only, since
we're only concerned about having static libraries for our bundled
dependencies.
2014-03-21 15:22:00 -04:00
Thomas Wienecke
1f578ec5a1 Add unit tests for mch_[gs]etperm.
Use preprocessor trick proposed by @mahkoh to import 'defines' like
S_IRUSR.
2014-03-15 11:50:22 -03:00
Thiago de Arruda
c3a88eb8ea Remove remaining hangul-related code 2014-03-14 08:29:47 -03:00
Thiago de Arruda
f6ace9962d Refactor travis build to use clang's sanitizers
- Valgrind configuration removed
- Fix errors reported by the undefined behavior sanitizer
- Travis will now run two build steps:
  - A normal build of a shared library for unit testing(in parallel with gcc)
  - A clang build with some sanitizers enabled for integration testing.

After these changes travis will run much faster, while providing valgrind-like
error detection.
2014-03-13 15:26:28 -03:00
Stefan Hoffmann
69967ccaba use more verbose output type for unittests on travis 2014-03-08 06:17:59 -03:00
Thiago de Arruda
cab5c25c70 Fix memory leak and enable valgrind on travis 2014-03-07 00:21:12 -03:00
John Szakmeister
1b5c3331dc Luarocks appears to be down, so let's use the mirror for now. 2014-03-07 00:15:52 -03:00
Islam Sharabash
f124ebadde Adding darwin platform to common.sh build script 2014-03-01 22:12:13 +00:00
Thiago de Arruda
4600b9c035 Add unit test running to travis again 2014-02-27 18:51:53 -03:00
John Szakmeister
ba7e4f0c0c Compile libuv with -fPIC.
This is needed so that th unit tests library compiles on 64-bit machines
correctly.
2014-02-27 18:50:06 -03:00
Thiago de Arruda
7637c2b664 Disable unit tests until fixed for travis 2014-02-27 18:37:57 -03:00
Thiago de Arruda
fd448123aa Add more example unit tests and run with travis 2014-02-27 18:31:45 -03:00
Thiago de Arruda
d04ca90f5c Add basic infrastructure for unit testing
Tests will be written using the [moonscript](http://moonscript.org/) language,
a lua 'dialect' that is whitespace-significant and has a syntax similar to
coffeescript. The test framework used is [busted](http://olivinelabs.com/busted/),
a bdd framework for lua/moonscript.

Luajit has a nice ffi module, which lets lua programs link shared libraries and
call it's functions without writing any C code.

To take advantage of this fact for testing C functions, a new target was added
to CMakeLists.txt, which compiles neovim as a shared library that is loaded by
the process running the tests.

This commit adds necessary code for downloading and installing a lua package
manager(luarocks) locally. It wasn't added as a subtree because there are quite
a few blobs in its source tree.
2014-02-27 17:55:10 -03:00
Thiago de Arruda
2c02f00b7c Enable stderr for test in travis
This is necessary to keep the build from 'erroring' since running the tests
with valgrind will take a long time
2014-02-26 22:42:10 -03:00
Thiago de Arruda
a2ce1df772 Modify travis configuration to install valgrind
This should fix previous build failures
2014-02-26 22:23:51 -03:00
Thiago de Arruda
a81d25e6e4 Remove -e option from travis shell script 2014-02-26 21:44:04 -03:00
Thiago de Arruda
c492c5e36d Fix travis script
It was broke because the ls command failed when no valgrind.* file were found
2014-02-26 21:38:21 -03:00
Thiago de Arruda
a97c1754ad Add test reporting to travis script 2014-02-26 21:33:39 -03:00
Thiago de Arruda
42a9654fae Enable valgrind when testing on travis
This will slow down testing but will detect pull requests that introduce memory
leaks.
2014-02-26 20:19:58 -03:00
Thiago de Arruda
baaf24acea Add valgrind suppression file 2014-02-26 16:21:20 -03:00
Thiago de Arruda
c002ffe2f3 Temporarily remove valgrind check in travis build 2014-02-26 15:57:27 -03:00
Thiago de Arruda
cb9a368445 Add configuration to help debug memory leaks 2014-02-26 15:48:26 -03:00
Thiago de Arruda
72c6523da5 Merge branch 'bundle-libuv' of github.com:rjw57/neovim into rjw57-bundle-libuv 2014-02-26 05:46:10 -03:00
ash-lshift
fffb8991fd silence tar when getting libuv 2014-02-25 09:11:16 +00:00
Theo Belaire
98f4c55e45 Silenced wget's progress bar
This way it won't show up in travis-ci like:

    0% [                                       ] 0           --.-K/s
    100%[======================================>] 371,453     --.-K/s
2014-02-25 09:06:15 +00:00
Theo Belaire
e7b0aa224a Added curl support and one test
Now it checks for the existance of curl after
failing to find wget.

Note that I ended up removing the quotes around $url
when referencing it in the call to wget, since urls can't have spaces
anyways, and the correct quoting was messy.

To test, I did

    rm -r .deps
    make clean
    make cmake
    make

And it worked.
2014-02-25 09:06:15 +00:00
Rich Wareham
d047b28ac1 get-libuv.sh: compile bundled libuv
Rename file to reflect new intent of script. Libuv is bundled into the
third-party directory. Modify the script to compile but not fetch libuv.
2014-02-24 10:09:07 +00:00
John Szakmeister
6241a49943 scripts/common.sh: remove a couple bashisms
This allows the scripts to work on systems that don't have /bin/bash as
/bin/sh--such as Debian.
2014-02-23 15:01:41 -05:00
Sean Long
87fdb40a03 First pass on getting build working on FreeBSD. 2014-02-22 16:25:20 -03:00
aph
63b571dfba fix build on OSX 2014-02-01 17:17:59 +00:00
Thiago de Arruda
6b0b466585 Automate libuv download and build 2014-02-01 11:20:02 -03:00