diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 14:36:22 +0200 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 15:32:53 +0200 |
commit | f4cf9fe05bb3f32fabea4e54dd92d368967a80da (patch) | |
tree | 487180fa9866985ea7b28e625651765d86f515c3 /meta/lib/oeqa/runtime/ping.py | |
download | poky-f4cf9fe05bb3f32fabea4e54dd92d368967a80da.tar.gz |
initial commit for Enea Linux 4.0
Migrated from the internal git server on the daisy-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'meta/lib/oeqa/runtime/ping.py')
-rw-r--r-- | meta/lib/oeqa/runtime/ping.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/ping.py b/meta/lib/oeqa/runtime/ping.py new file mode 100644 index 0000000000..a73c72402a --- /dev/null +++ b/meta/lib/oeqa/runtime/ping.py | |||
@@ -0,0 +1,20 @@ | |||
1 | import subprocess | ||
2 | import unittest | ||
3 | import sys | ||
4 | import time | ||
5 | from oeqa.oetest import oeRuntimeTest | ||
6 | |||
7 | class PingTest(oeRuntimeTest): | ||
8 | |||
9 | def test_ping(self): | ||
10 | output = '' | ||
11 | count = 0 | ||
12 | endtime = time.time() + 60 | ||
13 | while count < 5 and time.time() < endtime: | ||
14 | proc = subprocess.Popen("ping -c 1 %s" % self.target.ip, shell=True, stdout=subprocess.PIPE) | ||
15 | output += proc.communicate()[0] | ||
16 | if proc.poll() == 0: | ||
17 | count += 1 | ||
18 | else: | ||
19 | count = 0 | ||
20 | self.assertEqual(count, 5, msg = "Expected 5 consecutive replies, got %d.\nping output is:\n%s" % (count,output)) | ||