aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/osutil/osutil_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-06-17 12:11:24 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-06-17 12:11:24 +0200
commit13c5bfcc6ec165fe0cf988a3e92bbd8d8619411b (patch)
treefe684281ba2cccdc47b5639f9759b843dc30d2cd /pkg/osutil/osutil_test.go
parent3e647c355289b2beb2df529cc44f42ec31b6d75b (diff)
pkg/osutil: add IsExist helper function
Diffstat (limited to 'pkg/osutil/osutil_test.go')
-rw-r--r--pkg/osutil/osutil_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/osutil/osutil_test.go b/pkg/osutil/osutil_test.go
new file mode 100644
index 000000000..ee4cb6705
--- /dev/null
+++ b/pkg/osutil/osutil_test.go
@@ -0,0 +1,18 @@
+// Copyright 2017 syzkaller project authors. All rights reserved.
+// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+package osutil
+
+import (
+ "os"
+ "testing"
+)
+
+func TestIsExist(t *testing.T) {
+ if f := os.Args[0]; !IsExist(f) {
+ t.Fatalf("executable %v does not exist", f)
+ }
+ if f := os.Args[0] + "-foo-bar-buz"; IsExist(f) {
+ t.Fatalf("file %v exists", f)
+ }
+}