Commit Graph

171 Commits

Author SHA1 Message Date
Jeromy
e3cf893616 implement recursive indirect blocks
improve efficiency of multilayered indirect blocks

clean up tests

panic cleanup

clean up logic, improve readability

add final root node to the dagservice upon creation

importer: simplified dag generation

test: updated hashes using latest code

@whyrusleeping this is why the sharness tests
were failing: the hashes are added manually to
make sure our generation doesn't change.

cleanup after CR

fix merkledag tests

fix small block generation (no subblocks!)
2015-01-06 19:43:56 +00:00
Juan Batiz-Benet
0ba6bca130 sharness tests: added note re: daemon init 2015-01-05 08:08:56 -08:00
Juan Batiz-Benet
e785ad1d64 sharness: make sure not mounted
if a test is cancelled, unmount may not run. then, must
run umount before mounting, just to make sure.
2015-01-05 08:04:52 -08:00
Juan Batiz-Benet
b372b4879e sharness: init: bootstrap rm -all
sharness tests should not bootstrap to the dht. it
may be useful to test that specifically, but not on
the other tests.
2015-01-05 08:00:16 -08:00
Brian Tiger Chow
a8127a28e1 fix: force clean test results directory
Without `-f`, `make clean` fails on machines that don't have the dir.

cc @jbenet
2015-01-05 00:16:53 -08:00
Juan Batiz-Benet
c47b808d77 sharness/init: fixed ipfs init output 2015-01-05 00:09:49 -08:00
Jeromy
b241c8048f fix sharness test for ipfs init output 2015-01-05 00:02:56 -08:00
Juan Batiz-Benet
e407c2ef83 sharness: override test_cmp for verbose 2015-01-04 22:53:21 -08:00
Juan Batiz-Benet
481c19ac23 sharness: note in makefile describing TEST_VERBOSE 2015-01-04 22:30:59 -08:00
Juan Batiz-Benet
e5f24dc26b sharness: expanded on readme 2015-01-04 22:22:45 -08:00
Juan Batiz-Benet
be4191d800 sharness: nice verbose ouput
Make sharness tests' output helpful when verbose.
This means cating certain files, or running diagnostic
commands. I used a construction like:

    test_expect_success ".go-ipfs/ has been created" '
      test -d ".go-ipfs" &&
      test -f ".go-ipfs/config" &&
      test -d ".go-ipfs/datastore" ||
      fsh ls -al .go-ipfs
    '

The `|| ...` is a diagnostic run when the preceding command
fails. `fsh` is a trivial script that echoes the args, runs
the cmd, and then also fails, making sure the test case fails.
(wouldnt want the diagnostic accidentally returning true and
making it _seem_ like the test case succeeded).
2015-01-04 22:22:33 -08:00
Juan Batiz-Benet
d06e7e342d sharness: set verbosity from env 2015-01-04 20:39:23 -08:00
Juan Batiz-Benet
a9da519715 test/countineyn terminal and error code 2014-12-09 02:24:11 -08:00
Juan Batiz-Benet
b0e251bda1 Makefile: add test_all_commits 2014-12-08 20:39:00 -08:00
Christian Couder
aca62a420a Add sharness test for ipfs add --quiet
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-30 14:32:08 +01:00
Christian Couder
5e133a136c Add sharness tests for ipfs add and cat
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-23 21:02:39 +01:00
Christian Couder
196651d5f5 Add sharness mount tests with a 5 MB file
These new tests are not marked EXPENSIVE as they
should be fast enough even on Travis CI.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-20 20:46:02 +01:00
Christian Couder
c8e7a95644 Add an EXPENSIVE prereq and use it in t0040
We add this prereq to tests with a 100MB file
as they are slow on Travis CI.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-20 20:27:09 +01:00
Christian Couder
f06b9ca126 Rename test_launch_ipfs_mount into test_launch_ipfs_daemon_and_mount
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-20 20:11:03 +01:00
Christian Couder
1e077828cb Rename test_kill_ipfs_mount into test_kill_ipfs_daemon
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-20 20:03:41 +01:00
Christian Couder
882aac223e Add issue number to expected failures in sharness tests
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-19 21:21:03 +01:00
Christian Couder
2e566a7de3 Add sharness tests to document existing mount bugs
This uses test_expect_failure to document some bugs
related to 'ipfs mount'.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-18 22:44:28 +01:00
Juan Batiz-Benet
d124a6719e skip for now 2014-11-18 08:50:08 -08:00
Juan Batiz-Benet
d1ab80224d test: hack around travis being slow
this is a hack around travis key-gen being really slow.
One option would be to add the --key-bits option to daemon
as well. Another option would be to find a better way to
wait for the output, rather than waiting n seconds.

cc @chriscool thoughts?
2014-11-18 08:33:47 -08:00
Juan Batiz-Benet
3e96f4810b test: added daemon --init test 2014-11-18 08:19:25 -08:00
Juan Batiz-Benet
a7d1fd42d8 updating daemon addr output 2014-11-18 08:19:25 -08:00
Juan Batiz-Benet
e24b09f82d test: comment out extra output in add_and_cat 2014-11-18 06:21:07 -08:00
Juan Batiz-Benet
bd962b6c32 test: lower key size for mount tests 2014-11-18 06:18:32 -08:00
Juan Batiz-Benet
607e4d3e52 sharness tests back to cmd/ipfs 2014-11-18 06:14:59 -08:00
Juan Batiz-Benet
088016c850 test: cat test actual output 2014-11-17 22:36:19 -08:00
Juan Batiz-Benet
493e5d3b3e test: test init output 2014-11-17 22:36:19 -08:00
Christian Couder
220e108ddd Adapt mount tests to ipfs2 changes
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-16 03:20:11 -08:00
Christian Couder
b140c33839 Adapt t0010 to output from ipfs2
The ouput from "ipfs help" changed in ipfs2.
With the change in this commit, this output change doesn't
prevent the test to pass.

Test t0010 now passes on my Linux machine.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-16 03:20:11 -08:00
Christian Couder
68f7b50b5c Adapt t0050 to output from ipfs2
The ouput from "ipfs block" changed in ipfs2.
With the change in this commit, this output change doesn't
prevent the test to pass.

Test t0050 now passes on my Linux machine.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-16 03:20:10 -08:00
Christian Couder
30f28c00ce Adapt t0040 to output from ipfs2
The ouput from "ipfs add" changed in ipfs2.
With the changes in this commit, this output change doesn't
prevent the test to pass.

With TEST_NO_FUSE=1 test t0040 now passes on my Linux machine.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-16 03:20:10 -08:00
Brian Tiger Chow
4678dea045 tests(sharness) attempt to execute sharness tests on ipfs2
@jbenet @chriscool

(not to be merged into master) This is a hack to run sharness tests on
th ipfs2 binary. Instead of compiling cmd/ipfs, it compiles cmd/ipfs2
and copies this into test/bin/ipfs.

I thought this would be enough to pass the `basic-commands` test, but
it's not.

Although the output is fairly similar, the `ipfs version` test fails.

```
test (feat/test2) λ. diff version1 version2
1c1
< ipfs version 0.1.7
---
> ipfs version 0.1.5
```

I'm not very experienced with `sh` scripting, so perhaps I'm missing a
key ingredient or maybe misunderstanding the the tests are meant to
work.

Would like to get input on this.

Thanks, @maybebtc
2014-11-16 03:20:10 -08:00
Christian Couder
4a2cb9605c Update hashes in test/t0040-add-and-cat.sh
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-15 02:10:52 -08:00
Christian Couder
5dd17014fa Update test/README.md about sharness directory
Now sharness is in "lib/sharness"
2014-11-09 19:16:02 +01:00
Christian Couder
fc1a35e35a Add test script for block command
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-09 18:00:25 +01:00
Juan Batiz-Benet
1e434ef3c4 vendor: updated random + fixed test import
There is a dummy test import: test/lib/random-dep.go
Because godep doen't yet vendor binaries nicely.
2014-11-08 20:12:02 -08:00
Juan Batiz-Benet
4bf3e967d8 test/t0040-add-and-cat updated hashes (new random) 2014-11-08 20:12:02 -08:00
Juan Batiz-Benet
842de46ccf test: moved installed things into own dirs
I moved installed things into own dirs bin and lib.

@chriscool sorry to move things around again, the top level
test dir was getting a bit clutterd.
2014-11-08 20:12:02 -08:00
Juan Batiz-Benet
5680c112ef test: install random from vendored code 2014-11-08 18:49:28 -08:00
Juan Batiz-Benet
49f30b1597 added random to godeps 2014-11-08 18:49:01 -08:00
Christian Couder
e211b6543a Add a README.md to explain a few things 2014-11-08 02:44:03 +01:00
Christian Couder
2b5f1b2d8c Install sharness in a 'sharness' directory
It is cleaner if sharness is installed in its own
directory.
2014-11-08 02:44:03 +01:00
Juan Batiz-Benet
04efbb9a55 test: install random locally for travis. 2014-11-07 17:24:13 -08:00
Juan Batiz-Benet
c9ffe1a281 tests: use ipfs but with the right tool
Addresses comments in: 7e14f1737d
2014-11-07 16:24:44 -08:00
Juan Batiz-Benet
7ab38696f6 travis: fix install random error 2014-11-07 15:24:31 -08:00
Juan Batiz-Benet
7e14f1737d test/: build own ipfs tool to test
The tests were using the globally installed ipfs.
This commit changes it to build + use its own ipfs binary.
2014-11-07 15:16:29 -08:00
Juan Batiz-Benet
37279d55ca install go-random 2014-11-07 14:54:58 -08:00
Christian Couder
7e46d95145 Use a FUSE prerequisite to skip mount tests
When there is no fuse we should skip all mount
tests and using a FUSE prerequisite is a good
way to do that.
2014-11-07 14:54:58 -08:00
Juan Batiz-Benet
fc6213db09 dont test mount when no fuse 2014-11-07 14:53:55 -08:00
Juan Batiz-Benet
eee15baeb6 remove test-sharness-config 2014-11-07 14:53:55 -08:00
Juan Batiz-Benet
54651618e8 install aggregate-results.sh too 2014-11-07 14:53:55 -08:00
Juan Batiz-Benet
9535cb5802 install sharness 2014-11-07 14:53:55 -08:00
Juan Batiz-Benet
9434f6e531 tests: use shasum instead of sha1sum
sha1sum is not in osx by default.
shasum seems to be everywhere.
2014-11-07 14:13:12 -08:00
Christian Couder
22ac599703 test ipfs cat and ipfs add with a 100MB file
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-06 23:00:45 +01:00
Christian Couder
630816c7ee Speed up checking if mount works
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-01 15:29:27 +01:00
Christian Couder
4e2763a40a Refactor mount related tests
This adds test_launch_ipfs_mount() and test_kill_ipfs_mount()
to avoid duplicating tests to launch "ipfs mount" and to
kill it.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-11-01 10:52:09 +01:00
Christian Couder
e3da26d116 Add test script for add and cat commands
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-10-31 22:19:19 +01:00
Christian Couder
223d5c3001 Add trash directories into test/.gitignore
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-10-31 21:44:07 +01:00
Christian Couder
b6a98c10b3 Add test for ipfs mount
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-10-31 21:25:35 +01:00
Christian Couder
8357c7b13d Add test script for ipfs init
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-10-26 10:10:22 +01:00
Christian Couder
07bd18b53d Display which Makefile target is launched
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-10-26 10:10:22 +01:00
Christian Couder
47e7583464 Add test/.gitignore to ignore test-results/
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2014-10-25 22:25:18 +02:00
Christian Couder
aeb019f2b8 Add test/Makefile to run the test scripts
You can use it like this to launch all the
test scripts in order:

$ cd test
$ make
 rm -r test-results
 *** t0010-basic-commands.sh ***
 ok 1 - current dir is writable
 ok 2 - ipfs version succeeds
 ok 3 - ipfs version output looks good
 ok 4 - ipfs help succeeds
 ok 5 - ipfs help output looks good
 # passed all 5 test(s)
 1..5
 ./test-aggregate-results.sh
 fixed   0
 success 5
 failed  0
 broken  0
 total   5

Or you can just run one test like this:

$ make t0010-basic-commands.sh
 *** t0010-basic-commands.sh ***
 ok 1 - current dir is writable
 ok 2 - ipfs version succeeds
 ok 3 - ipfs version output looks good
 ok 4 - ipfs help succeeds
 ok 5 - ipfs help output looks good
 # passed all 5 test(s)
 1..5
2014-10-25 14:12:27 +02:00
Christian Couder
0aebe75361 Add test-aggregate-results.sh
This script aggregates test results using Sharness.
2014-10-25 14:12:20 +02:00
Christian Couder
1fb4192642 Move Sharness config checks into test-sharness-config.sh
This way we can easily reuse the checks in
test-sharness-config.sh.
2014-10-25 13:58:54 +02:00
Christian Couder
12490cb477 Add t0010-basic-commands.sh
This checks a little bit the installation and some
basic commands.

You can run it like that:

$ cd test
$ ./t0010-basic-commands.sh
 ok 1 - current dir is writable
 ok 2 - ipfs version succeeds
 ok 3 - ipfs version output looks good
 ok 4 - ipfs help succeeds
 ok 5 - ipfs help output looks good
 # passed all 5 test(s)
 1..5
2014-10-25 13:57:19 +02:00
Christian Couder
449523eebd Add test-lib.sh for our shell test framework
Our test framework is based on Sharness.
So the first thing to do is to source it.
2014-10-25 13:53:57 +02:00