Skip to content

Commit 1cef170

Browse files
committedOct 19, 2015
add small sharness test to make sure output happens
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
1 parent 11104d4 commit 1cef170

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
 

‎core/commands/sysdiag.go

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"runtime"
77

88
cmds "github.com/ipfs/go-ipfs/commands"
9+
config "github.com/ipfs/go-ipfs/repo/config"
910

1011
manet "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
1112
psud "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/shirou/gopsutil/disk"
@@ -51,6 +52,8 @@ Prints out information about your computer to aid in easier debugging.
5152
return
5253
}
5354

55+
info["ipfs_version"] = config.CurrentVersionNumber
56+
info["ipfs_git_sha"] = config.CurrentCommit
5457
res.SetOutput(info)
5558
},
5659
}

‎test/sharness/t0151-sysdiag.sh

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2015 Jeromy Johnson
4+
# MIT Licensed; see the LICENSE file in this repository.
5+
#
6+
7+
test_description="test output of sysdiag command"
8+
9+
. lib/test-lib.sh
10+
11+
test_init_ipfs
12+
13+
test_expect_success "ipfs diag sys succeeds" '
14+
ipfs diag sys > output
15+
'
16+
17+
test_expect_success "output contains some expected keys" '
18+
grep "virt" output &&
19+
grep "interface_addresses" output &&
20+
grep "arch" output
21+
'
22+
23+
test_expect_success "uname succeeds" '
24+
UOUT=$(uname)
25+
'
26+
27+
test_expect_success "output is similar to uname" '
28+
case $UOUT in
29+
Linux)
30+
grep linux output > /dev/null
31+
;;
32+
Darwin)
33+
grep darwin output > /dev/null
34+
;;
35+
FreeBSD)
36+
grep freebsd output > /dev/null
37+
;;
38+
CYGWIN*)
39+
grep windows output > /dev/null
40+
;;
41+
*)
42+
test_fsh echo system check for $UOUT failed, unsupported system?
43+
;;
44+
esac
45+
'
46+
47+
test_done

0 commit comments

Comments
 (0)
Please sign in to comment.