Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test repeat in 10 sec: increase check frequency tenfold #1326

Merged
merged 1 commit into from
Jun 3, 2015

Conversation

rht
Copy link
Contributor

@rht rht commented Jun 3, 2015

No description provided.

@jbenet jbenet added the backlog label Jun 3, 2015
jbenet added a commit that referenced this pull request Jun 3, 2015
Test repeat in 10 sec: increase check frequency tenfold
@jbenet jbenet merged commit 18297e2 into ipfs:master Jun 3, 2015
@jbenet jbenet removed the backlog label Jun 3, 2015
@jbenet
Copy link
Member

jbenet commented Jun 3, 2015

@rht thanks!

@rht
Copy link
Contributor Author

rht commented Jun 3, 2015

Ok will at least replace with test_seq.

The tests in sharness are meant to be passed by the node & python implementation, right?
The granular check didn't cut the test time that much, so now I am in favor for integer sleep (and so no boilerplate dependency for other implementation). Unless absolutely necessary.

@rht
Copy link
Contributor Author

rht commented Jun 3, 2015

I wonder if there is a checker for sh for POSIX compliance.

@chriscool
Copy link
Contributor

In Git test_seq uses Perl but we don't want to depend on Perl I think.

@rht
Copy link
Contributor Author

rht commented Jun 3, 2015

e.g. debian posh

@chriscool
Copy link
Contributor

Unfortunately it looks like http://www.shellcheck.net/ doesn't check for POSIX compliance.

@rht
Copy link
Contributor Author

rht commented Jun 3, 2015

Also shellcheck is less portable than perl (no binary build in https://github.com/koalaman/shellcheck).

I think any of posh, dash, bsh is sufficient to check for POSIX compliance.
With dash being the most available everywhere (I can't find posh in yum/rpm/homebrew. I didn't check for bsh though).

@jbenet
Copy link
Member

jbenet commented Jun 3, 2015

The best way if we really want to sleep for less than a second might be to write or find a go program that sleeps for the specified amount of time. It might use: http://golang.org/pkg/time/#Sleep

Let's do this. The fractional seconds add up. I'd like to have our tests wait as little time as we can make them.

@rht
Copy link
Contributor Author

rht commented Jun 3, 2015

What about perl -MTime::HiRes -e 'sleep(0.1)' + test_seq?
Since sharness already assumes that perl exists.
And 0.1s is an order of magnitude longer than the load time concern in http://stackoverflow.com/questions/7757814/how-to-sleep-a-random-fraction-of-a-second-in-posix-shell.

And what about reusing the test for other lang implementation?

@chriscool
Copy link
Contributor

Where does sharness assumes that perl exists?

Greping for perl, I found only:

test/3nodetest/bin/save_logs.sh:STRIP="perl -pe 's/\e\[?.*?[\@-~]//g'"

which is not part of sharness.

@rht
Copy link
Contributor Author

rht commented Jun 3, 2015

Ah right, it is git test that uses perl, while sharness is pure shell.

Hence any util that is not fully portable is to be written in go?
Including seq (and curl)?

@chriscool
Copy link
Contributor

@rht yeah we often write some small utils in go, when we need them and there is no easy way to have them in POSIX shell.
About seq we can implement test_seq in POSIX shell using expr.
About curl, for now we accept that we depend on it, but the long term goal is to replace it with a go binary.

@chriscool
Copy link
Contributor

See PR #1329 for test_seq in POSIX shell using expr.

@chriscool
Copy link
Contributor

About sleeping for some milliseconds there is now, shamelessly stolen from go-random:

https://github.com/chriscool/go-sleep

@jbenet
Copy link
Member

jbenet commented Jun 3, 2015

@chriscool 👍

@chriscool
Copy link
Contributor

By the way after sleeping a bit on it myself :-) I think I will rename it soon like "go-millisleep".

@jbenet
Copy link
Member

jbenet commented Jun 4, 2015

haha, i like it. (maybe can use seconds but allow fractions. (i.e. parse it as a time.Duration))

@rht
Copy link
Contributor Author

rht commented Jun 4, 2015

Which one is usually preferable: sleep 0.1, gosleep 0.1 (like golint), or go sleep 0.1, or go-sleep/go sleep (as in git-clone/git clone)?

@jbenet
Copy link
Member

jbenet commented Jun 5, 2015

I'd say:

sleep 0.1

But this may clash with other tools so another name is ok. Don't use "go sleep" as that should only be a tool part of the go distribution 

@cryptix
Copy link
Contributor

cryptix commented Jun 5, 2015

Like this a lot.

I opened PR chriscool/go-sleep#1 to use time.ParseDuration() instead. go-sleep 2s is much easier to approach for new people IMHO.

@rht
Copy link
Contributor Author

rht commented Jun 5, 2015

go sleep 0.1!# This is all for the want of the machines to sleep less and less. For the same reason we want an ever faster in-time compiler.

@chriscool
Copy link
Contributor

I merged @cryptix's PR so now it is sleep 100ms, but I think I will rename the command to go-sleep.

@chriscool
Copy link
Contributor

I renamed it go-sleep as it is the most logical given the name of the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants