From 13c5bfcc6ec165fe0cf988a3e92bbd8d8619411b Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 17 Jun 2017 12:11:24 +0200 Subject: pkg/osutil: add IsExist helper function --- pkg/osutil/osutil_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 pkg/osutil/osutil_test.go (limited to 'pkg/osutil/osutil_test.go') 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) + } +} -- cgit mrf-deployment