Commit Graph

418 Commits

Author SHA1 Message Date
Rudi Grinberg bdeef73c29 Add test for proper concatenation
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:34 +07:00
Jeremie Dimino 124d942310 s/jbuild/dune/ in misc test
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-06 23:42:33 +07:00
Rudi Grinberg 9221b1ed6c Change echo to be variadic
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:33 +07:00
Rudi Grinberg eab7c46bdb Add flag to allow/disallow multivalue expansions
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:42:33 +07:00
Rudi Grinberg 69c0ab48ce Add test for concat_or_split
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-06 23:41:57 +07:00
Jérémie Dimino bb7827a7b2
Make the output of Dune deterministic in tests (#855)
When the root is not the cwd, print a relative path for the "Entering
..." line rather than an absolute one.

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-06 16:25:04 +01:00
Jeremie Dimino ec6ca4be67 Refactor handling of backend selection errors + add tests
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jeremie Dimino 898a2ffa02 Update gen-opam-install-file test
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jeremie Dimino b5dfb826ef Restore old ppx behavior for directories with jbuild files
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jeremie Dimino ed583b7651 Add List.assoc
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jeremie Dimino b35fbbd7b2 Abstract the ppx driver system
- remove hard-coded knowledge of ocaml-migrate-parsetree and ppx_driver
- get the exact driver parameters directly from the driver itself

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-05 19:19:10 +01:00
Jeremie Dimino 23a9c65ade make promote
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-04 16:26:13 +01:00
Jeremie Dimino 5b01ed8246 Add support for block strings
Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-04 13:57:27 +01:00
Jeremie Dimino b7afc006ee Drop support block and sexp comments in Dune files
They are almost never used and they complicate the language. The
parsing of jbuild files in unchanged.

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-04 13:57:27 +01:00
Rudi Grinberg 077df76f6d Add a ppx rewriter example for the generated install file (#850)
Add an example using jbuild and dune files.

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-04 12:08:20 +01:00
Rudi Grinberg be7e3d6dfc Implement --build-dir and change Path.t to use symbolic paths
The motivation for this change is implement the --build-dir feature. This
feature lets us control the build directory which previously always defaulted to
_build. To accomplish this, Path.t had to be modified to be:

External of External.t | In_source_tree of Local.t | In_build_dir of Local.t

To represent the 3 kinds of paths dune is dealing with. The In_build_dir
constructor in particular, is relative to Path.root or some external path.

A few other refactorings had to be done to support this transition:

* The workspace is now "settable". This means that we no longer have to pass it
  explicitly when converting local to absolute paths.

* Path.is_local no longer makes sense and is renamed to Path.is_managed.
  Roughly, is_managed identifies paths in the build and source directories.

* Path.absoulte has been renamed of_filename_relative_to_initial_cwd

* Path.Local.root is now "." (as opposed to "")

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-02 18:14:44 +07:00
Rudi Grinberg 5ea3b1f533
Merge branch 'master' into quoting-test-quoted-case 2018-06-01 17:12:14 +07:00
Rudi Grinberg d17292f6cd Add quoted case to quoting test
When ${@}, the current behavior should be preserved

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-06-01 16:49:12 +07:00
Jeremie Dimino 39e74826f4 Simplify the parser
Replace the current generated parser by an ocamllex lexer + a simple
parser.

The new code is:
- much simpler and smaller
- shouldn't cause ocamlopt to stack overflow anymore on BSD systems
- slightly slower but not that much

Signed-off-by: Jeremie Dimino <jdimino@janestreet.com>
2018-06-01 08:42:45 +01:00
Rudi Grinberg b057c40668
Merge branch 'master' into add-classical-ppx-test 2018-05-31 10:43:22 +07:00
Rudi Grinberg 0677c2d79c Add test for using a dune library with ocamlfind
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-30 15:39:58 +07:00
Rudi Grinberg 939341af16 Add test for classical ppx
Test that generated META can be used by ocamlfind

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-30 14:59:37 +07:00
Rudi Grinberg 8f16afe293 Fix merlin generation
The optional build contexts were being dropped from the obj dirs instead of the
source dirs.

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-05-30 14:39:47 +07:00
Rudi Grinberg 88e71c3432
Speed up merlin generation (#805)
Improve merlin generation by minimizing intermediate strings and reusing a buffer.
2018-05-26 11:04:21 +07:00
Anil Madhavapeddy b2dd904847 odoc: make indexes work with the development version of odoc
We now generate library titles at level 2 instead of level 1,
and remove trailing fullstop after the `modules` entry.

The development branch of odoc has a more precise parser that
enforces that there is only a single title level field in the
generated odoc.

Closes #791

Signed-off-by: Anil Madhavapeddy <anil@recoil.org>
2018-05-23 10:59:19 +01:00
Rudi Grinberg dc254638e3
Merge pull request #780 from ocaml/dup-fields
Allow to define that can appear multiple times
2018-05-21 00:13:58 +07:00
Rudi Grinberg 3548e2f6d4
Merge pull request #777 from rgrinberg/spec-reach-for-running
Add tests for reach_for_running
2018-05-20 23:57:40 +07:00
Rudi Grinberg a6f2b5be9b Fix exception to be friendly when loc is available
When the loc is available, the error is likely because of an ill-defined user
rule. We should simply reflect the location back to the user.
2018-05-20 13:22:59 +07:00
Rudi Grinberg b1be607b9b Reproduce stack trace leaking out to user 2018-05-20 13:14:24 +07:00
Rudi Grinberg 9a62e70471 Fix command line printing for errors 2018-05-19 18:11:31 +07:00
Jeremie Dimino cae4948b72 Allow fields that can appear multiple times 2018-05-19 10:14:50 +01:00
Jeremie Dimino 9d3117d63e Fix bug exposed by previous commit 2018-05-17 15:48:19 +01:00
Jeremie Dimino 0d27e9f909 Expose a bug in the S-expression record parser 2018-05-17 15:42:40 +01:00
Rudi Grinberg 8cea102d3c Fix type of Path.reach_for_running
It should return a string rather than a path. Also, make Process.run use it
rather than relying on the caller to do it.
2018-05-17 20:23:48 +07:00
Rudi Grinberg a834e6f6ba Add tests for reach_for_running 2018-05-17 12:56:35 +07:00
Rudi Grinberg da827f7946
Merge pull request #769 from rgrinberg/fix-764
Detect circular sym links
2018-05-16 21:58:22 +07:00
Jeremie Dimino 58de56ad0d Remove useless call 2018-05-16 15:19:04 +01:00
Jeremie Dimino 62997d6676 fix 2018-05-16 15:18:36 +01:00
Jeremie Dimino 2cf1631730 Try again 2018-05-16 15:15:45 +01:00
Jeremie Dimino 46479fd083 Try to make tests pass in Travis 2018-05-16 14:40:21 +01:00
Jeremie Dimino 2192a549f4 Use dev/inode to detect loops 2018-05-16 14:23:01 +01:00
Jeremie Dimino 3a2e136e5c Add a more complex test 2018-05-16 13:54:12 +01:00
Jeremie Dimino 2033b34983 Update tests
- remove tests that were creating files outside the test directory
- add tests with cycles longer than 1
2018-05-16 13:12:45 +01:00
Jérémie Dimino 95d9cf0415
Refactor Jbuild.Scope_info.Name and Dune_project.name (#775) 2018-05-15 14:07:02 +01:00
Rudi Grinberg 241ec87a2b Add test for symlinking outside workspace 2018-05-15 19:42:33 +07:00
Rudi Grinberg c9916f4a76 Add some more test cases for symlinks 2018-05-15 17:33:51 +07:00
Rudi Grinberg c1f81bef64 Add test for #764 2018-05-15 17:33:27 +07:00
Rudi Grinberg 19825ae012
Merge pull request #751 from rgrinberg/is-in-build-dir-weird-behavior
Path.is_in_build_dir test
2018-05-14 17:01:06 +07:00
Rudi Grinberg 4b798c048c Remove try/with from Path unit tests 2018-05-14 16:48:06 +07:00
Rudi Grinberg dc3310c3a0 Remove try/with from Path unit tests 2018-05-12 22:31:20 +07:00
Jérémie Dimino bc19e14b35
Add ignored_subdirs stanza (#767) 2018-05-12 15:38:22 +02:00
Rudi Grinberg 33a99884e4 Improve tests of Path.descendant
It should test cases where the paths are build dirs
2018-05-12 12:50:43 +07:00
Rudi Grinberg 3a8e4cf54d Fix off by 1 in Path.is_descendant 2018-05-11 10:30:21 +07:00
Rudi Grinberg b6851d7cd7 Add tests Path.is_descendant
Notabley, Path.is_descendant is broken for some relative paths
2018-05-11 10:24:12 +07:00
Rudi Grinberg 909142cf6c Add tests for Path.drop_build_context 2018-05-11 09:43:30 +07:00
Rudi Grinberg f9f15ceacf Use exceptions over result type in expect test
There's no need to hide stack traces since we turned them off
2018-05-11 09:43:27 +07:00
Rudi Grinberg f4a5413c46 Don't record backtraces 2018-05-11 09:37:31 +07:00
Jeremie Dimino bffd5407ce Fix #734 2018-05-10 11:31:39 +01:00
Jeremie Dimino 30d05eb4f1 Add test for #734 2018-05-10 11:31:39 +01:00
Jeremie Dimino ef7a5519aa Fix #761 2018-05-10 11:27:56 +01:00
Jeremie Dimino ba78e05d95 Add a test for #761 2018-05-10 11:27:56 +01:00
Jeremie Dimino 7c1e1923a0 Fix #759 2018-05-09 16:32:35 +01:00
Jeremie Dimino 4ffa88726a Add a test for #759 2018-05-09 16:21:01 +01:00
Rudi Grinberg 7a1b3954d7 Change path tests not to include line numbers in stack traces
Only include exception names
2018-05-09 17:58:12 +07:00
Rudi Grinberg f7f22cbf52 Make Path.parent return option
Use _exn whenever we know the parent exists
2018-05-09 17:56:50 +07:00
Rudi Grinberg 47d54854e4 Safety feature for Path.rm_rf 2018-05-09 17:11:09 +07:00
Rudi Grinberg 08b33331ea Path.rm_rf test 2018-05-09 17:10:41 +07:00
Rudi Grinberg 5112c23e3f
Merge pull request #746 from rgrinberg/alias0-build-dir
Alias0.dir is always in build_dir
2018-05-09 14:50:55 +07:00
Rudi Grinberg 7d17a30a99 Unit tests for current Path.append behavior 2018-05-09 09:14:21 +07:00
Rudi Grinberg 8eba040b92 Rename Alias.of_path to Alias.of_user_written_path
And add a loc argument for correct error messages
2018-05-09 08:05:57 +07:00
Rudi Grinberg 76c1a32da4 Add tests for invalid alias paths 2018-05-09 08:05:57 +07:00
Rudi Grinberg 0f8dcc5848 Change Path.insert_after_build_dir_exn not to hard code _build
Use the build_dir variable rather than the "_build" string and treat the case
Path.build_dir argument differently. Previously this would error:

Path.insert_after_build_dir_exn Path.build_dir "foo"

Now, it will return _build/foo
2018-05-08 18:55:19 +07:00
Rudi Grinberg 6ee133b4dd Tests for insert_after_build_dir_exn 2018-05-08 17:26:14 +07:00
Rudi Grinberg fadc57040b Path.absolute tests 2018-05-08 16:50:49 +07:00
Rudi Grinberg 9dcbc4ce53 Add unit tests for Path.relative 2018-05-07 22:46:28 +07:00
Rudi Grinberg c149043fde Tests for Path.reach 2018-05-07 22:41:43 +07:00
Jérémie Dimino 4d8ca489be
Add support for environment & build profiles (#419) 2018-05-04 16:49:25 +01:00
Jeremie Dimino adde723702 Update tests 2018-05-04 12:26:26 +01:00
Jeremie Dimino dabb77eb09 Rename all jbuild.inc files 2018-05-04 12:26:26 +01:00
Jeremie Dimino dc0a6d4401 Rename all jbuild files 2018-05-04 12:26:26 +01:00
Jérémie Dimino 325584adfc
Renaming to Dune (#721)
- install two identical binaries: jbuilder and dune
- rename the man pages to dune-*
- change the name in man pages
- change the name of libraries
- add support for dune-project files and add a dune-project file
- add support for dune-workspace files
- start updating the manual
- update the tests
2018-05-02 12:56:12 +01:00
Rudi Grinberg 623ebfc2da Add expectation test to parsing out of findlib toolchain config 2018-05-01 20:16:19 +07:00
Rudi Grinberg 7b17fa013f Fix #717
Extensions should be removed from the map of basenames to mld paths
2018-04-29 00:52:29 +07:00
Rudi Grinberg 575cbce699 Add test showing odoc failure with index.mld 2018-04-29 00:34:53 +07:00
Rudi Grinberg 40631805ef Multiple private libs requires odoc 2018-04-27 23:30:42 +07:00
Rudi Grinberg 558b372cf0 Add unit tests to target without deps 2018-04-27 21:55:43 +07:00
Rudi Grinberg f84550b98a Tag jsoo and utop tests as taking externals 2018-04-27 21:34:48 +07:00
Jérémie Dimino 8796df8a74
Fix flags in output-obj test (#728) 2018-04-26 18:47:20 +01:00
Rudi Grinberg c406a51bb3 Fix github25 tests 2018-04-26 11:46:14 +01:00
Rudi Grinberg f8c348983e Skip <4.06.0 for output-obj 2018-04-26 11:46:14 +01:00
Rudi Grinberg be3840005e Generate blackbox tests
Generate these tests from the listing of directories. This allows us to
effectively mark which tests are not working in certain conditions/platforms.
2018-04-26 11:46:14 +01:00
Rudi Grinberg 7820e29d28 Port Io to use Path.t 2018-04-25 03:25:27 +07:00
Rudi Grinberg bc2a375e2c
Merge pull request #719 from rgrinberg/path-stdune
Move Sexp to Studune
2018-04-24 20:30:52 +07:00
Jeremie Dimino dfbb609d39 Update output-obj tests 2018-04-24 13:51:57 +01:00
Jeremie Dimino 85f434de2b Improve path.mlt 2018-04-24 13:37:53 +01:00
Rudi Grinberg 6aa1b84fee Move Path to Stdune
* This requires moving Fatal_error and Loc_error to Stdune.Exn as well

* Clflags.workspace_root can no longer be used in Path.to_absolute_filename. We
  just take a parameter instead for now.
2018-04-24 19:33:40 +07:00
Rudi Grinberg e991c261ca
Merge pull request #716 from rgrinberg/sexp-stdune
Move Code_error to stdune
2018-04-23 18:20:15 +07:00
Rudi Grinberg 98b2ea795c Move String_map to stdune 2018-04-23 12:43:20 +07:00
Rudi Grinberg 709385ed66 Don't rely on "ext_exe" always being present
It's not present in older OCaml, so we need to guess the ext_exe ourselves.
2018-04-20 17:32:48 +07:00
Rudi Grinberg 13eea737f9 Don't use getenv_opt in configurator test 2018-04-20 17:32:37 +07:00
Rudi Grinberg 6819749550 Remove -ocamlv arg from cram tests
The ocamlc config is passesd courtesy of configurator anyway
2018-04-18 23:14:32 +07:00
Rudi Grinberg ab50461741 Make extensions portable in cram output
With some really ugly post processing
2018-04-18 21:21:09 +07:00
Rudi Grinberg f8f1a4036e Change cram.mll to not use anon args 2018-04-18 19:30:40 +07:00
Etienne Millon ec9ff813ad Fallback to implementation if there is no mli 2018-04-17 15:51:29 +01:00
Etienne Millon 40624e744b Build transitive dependencies with ocamldep
This uses two different extensions:

- `.d` corresponds to the raw `ocamldep` output.
- `.all-deps` corresponds to this output, merged with the dependencies
of all the interfaces mentioned in the earlier.

This also means that `.all-deps` files will contain output from multiple
files.
2018-04-17 15:51:29 +01:00
Etienne Millon 0cf8a8240a Add tests
The symptoms are a bit different depending on the presence of an
interface file.
2018-04-17 15:51:29 +01:00
Rudi Grinberg 9414913286 Add test to make sure that ${null} isn't a target 2018-04-17 10:58:53 +07:00
Rudi Grinberg 8c86604ee6 Add test to show that jbuilder mishandles ${null}
Jbuilder incorrectly infers ${null} to be a target
2018-04-17 10:37:34 +07:00
Rudi Grinberg 69b76f0c8e Add ?prelude argument when import constants
A user can now define their own macros to use with extracting compile time info
2018-04-17 00:26:23 +07:00
Rudi Grinberg c1ca2f96b9 Improve configurator tests
* Don't use asserts to test extracted values. Just print them and relying on
  diffing for comparison

* Use a string constant type.
2018-04-16 13:01:25 +07:00
Rudi Grinberg f1f60c4081
Merge pull request #695 from rgrinberg/dune-pass-ocamlc
Pass ocamlc explicitly to configurator using DUNE_CONFIGURATOR
2018-04-12 19:48:58 +07:00
Jérémie Dimino db41c3549b
Add a test showing a weird quoting problem (#699) 2018-04-12 13:02:41 +01:00
Rudi Grinberg d65845abb8 Pass ocamlc explicitly to configurator using DUNE_CONFIGURATOR 2018-04-11 21:26:51 +07:00
Rudi Grinberg a3a9a1c719 Move current configurator API to V1 module 2018-04-11 09:43:37 +07:00
Rudi Grinberg 148835967e Add tests for import defines 2018-04-10 22:05:52 +07:00
Rudi Grinberg fb8d400165 Add formatting to configurator tests 2018-04-10 22:05:52 +07:00
Rudi Grinberg 8ee13dde4d Test compiling C program 2018-04-10 22:05:52 +07:00
Rudi Grinberg ab9b278304 Add actual test suite for configurator 2018-04-10 22:05:52 +07:00
Rudi Grinberg 62bbd5d30e
Merge pull request #671 from rgrinberg/pr/653
Cosmetic changes for default package entry point.
2018-04-10 20:04:28 +07:00
Jeremie Dimino 22b024a977 More hacks for external-lib-deps
Fix #644
2018-04-09 06:31:52 +08:00
Jeremie Dimino 606ad1b10f Pass around library dependencies as static values
This way we know more of the compilation DAG statically. This helps
for parallelism as well as for `jbuilder external-lib-deps`
2018-04-09 06:31:52 +08:00
Rudi Grinberg 18948faff8 Use hand made pretty printers for top level expect tests
These tests would fail in 4.02.3 because of the toplevel choosing to print some
module paths differently
2018-04-05 23:03:07 +08:00
Jeremie Dimino 4c9de316f0 Simplify blackbox tests
Remove all the -j1, --root ., --display quiet
2018-04-03 11:44:10 +08:00
Jeremie Dimino 24de79934b Simplify a bit blackbox tests
- make them depend on (package jbuilder)
- s/$JBUILDER/jbuilder/
2018-04-03 11:42:29 +08:00
Thomas Refis 77c717b9af Cosmetic changes for default package entry point. 2018-04-03 00:54:30 +08:00
Rudi Grinberg 244773ef80 Improve odoc tests to test wrapped and non wrapped module listings 2018-04-03 00:51:21 +08:00
Anton Bachin f29ff0945d Place module list on its own line (take 2)
See eb05f4f643 and
https://github.com/ocaml/dune/pull/367#issuecomment-352209790.
2018-04-03 00:13:36 +08:00
Rudi Grinberg ff211b18a7 Fix lazy loading of rules
We must load package rules when a file in the _mld dir is requested
2018-04-02 23:15:56 +08:00
Rudi Grinberg 1b1c5f032d Test to show broken lazy loading of rules 2018-04-02 23:15:07 +08:00
Jeremie Dimino 84251a5b81 Update tests as order of deps changed 2018-03-30 16:47:56 -04:00
Jeremie Dimino fb101857d4 Extend test for #644 2018-03-27 17:46:21 -04:00
Jeremie Dimino ad00c1509f Fix #657 2018-03-27 17:25:25 -04:00
Jeremie Dimino daef49ce55 Add test for #657 2018-03-27 17:25:25 -04:00
Jeremie Dimino 103af8627c Added a reproduction case for #644 2018-03-27 14:50:36 -04:00
Rudi Grinberg fae5e78fc2 Change Meta.load to return the simplified meta
It's always simplified anyway
2018-03-23 10:12:34 +08:00
Rudi Grinberg 2ea04b706b Add another package to odoc tests 2018-03-22 20:40:46 +08:00
Rudi Grinberg 1c77992a28 Add test for #637 regression 2018-03-22 00:03:35 +08:00
Jeremie Dimino c685e8ac6d Remove useless load_dir 2018-03-19 01:24:04 +08:00
Jeremie Dimino a729409fa7 Update the package-dep test to test dependencies between packages 2018-03-19 01:22:44 +08:00
Rudi Grinberg 727d9688e9 Add tests for (package foo) dependency type 2018-03-19 01:17:31 +08:00
Rudi Grinberg 4a0f4c0ff9 Fix encoding of inline_tests
Encode optional fields as records where optional keys that are None will be
omitted in the resultant sexp. This will match reading the keys back with field_o
2018-03-18 22:48:42 +08:00
Rudi Grinberg 7a26c18e20 New odoc rules 2018-03-18 17:44:08 +08:00
Jeremie Dimino 41cdb98e63 Improve sexp tests 2018-03-17 14:23:43 +00:00
Jeremie Dimino e3f34fab71 Add a test for Usexp.Atom.is_valid 2018-03-17 14:23:43 +00:00
Rudi Grinberg f39b302a8d Fix Atom definition of Usexp
Fix the is_valid function to only validate atoms that don't contain spaces,
parens, comment characters.
2018-03-17 14:23:43 +00:00
Rudi Grinberg 154b405e51 use str as runner dep 2018-03-17 14:23:43 +00:00
Rudi Grinberg a8ee7bfad5 Add test witnessing generation of backend dune files
It shows that jbuilder fails to correctly escape the action field
2018-03-17 14:23:43 +00:00
Rudi Grinberg 521a36dcef
Merge pull request #603 from diml/universe
Allow to depend on the universe
2018-03-14 13:02:23 +07:00
Jeremie Dimino e2adf9d44a Allow to depend on the universe
Fix #255
2018-03-13 19:12:57 +00:00
Rudi Grinberg daf95cef09 private/public tests with (optional)
Currently, a library marked (optional) will not build if it's public and has a
private dependency.
2018-03-14 02:37:11 +08:00