Move gl_Bench into a dep so that it can be re-used among tests
Review URL: http://codereview.chromium.org/870005
diff --git a/client/deps/glbench/README b/client/deps/glbench/README
new file mode 100644
index 0000000..4a879d7
--- /dev/null
+++ b/client/deps/glbench/README
@@ -0,0 +1,7 @@
+# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+This deps brings install ChromeOS glbench into an image. Tests that depend on
+glbench should add this as a dep in the setup. It leverages the Chrome OS
+build system and installs the package that gets created for glbench.
diff --git a/client/deps/glbench/common.py b/client/deps/glbench/common.py
new file mode 100644
index 0000000..ac26b5d
--- /dev/null
+++ b/client/deps/glbench/common.py
@@ -0,0 +1,12 @@
+# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os, sys
+dirname = os.path.dirname(sys.modules[__name__].__file__)
+client_dir = os.path.abspath(os.path.join(dirname, "../../"))
+sys.path.insert(0, client_dir)
+import setup_modules
+sys.path.pop(0)
+setup_modules.setup(base_path=client_dir,
+ root_module_name="autotest_lib.client")
diff --git a/client/deps/glbench/control b/client/deps/glbench/control
new file mode 100644
index 0000000..e37d22e
--- /dev/null
+++ b/client/deps/glbench/control
@@ -0,0 +1,5 @@
+# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+job.setup_dep(['glbench'])
diff --git a/client/deps/glbench/glbench.py b/client/deps/glbench/glbench.py
new file mode 100755
index 0000000..501f386
--- /dev/null
+++ b/client/deps/glbench/glbench.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import common, os, shutil
+from autotest_lib.client.bin import utils
+
+version = 1
+
+def setup(topdir):
+ my_srcdir = os.path.join(topdir, 'src.orig')
+ srcdir = os.path.join(topdir, 'src')
+ shutil.move(my_srcdir, srcdir)
+ os.chdir(srcdir)
+ utils.system('make')
+ os.chdir(topdir)
+
+pwd = os.getcwd()
+utils.update_version(pwd + '/src', False, version, setup, pwd)
diff --git a/client/site_tests/gl_Bench/src/Makefile b/client/deps/glbench/src.orig/Makefile
similarity index 97%
rename from client/site_tests/gl_Bench/src/Makefile
rename to client/deps/glbench/src.orig/Makefile
index b05af65..3f5a48d 100644
--- a/client/site_tests/gl_Bench/src/Makefile
+++ b/client/deps/glbench/src.orig/Makefile
@@ -6,7 +6,7 @@
CXXFLAGS = -g -Wall -Werror -I$(GCLIENT_ROOT)/src/third_party/chrome/files
LDFLAGS = -lGL -lX11 -L$(GCLIENT_ROOT)/src/third_party/chrome -lbase -lrt
-TARGET = ../gl_Bench
+TARGET = ../glbench
GCLIENT_ROOT ?= ../../../../../../../..
diff --git a/client/site_tests/gl_Bench/src/bench.cc b/client/deps/glbench/src.orig/bench.cc
similarity index 100%
rename from client/site_tests/gl_Bench/src/bench.cc
rename to client/deps/glbench/src.orig/bench.cc
diff --git a/client/site_tests/gl_Bench/src/egl_stuff.cc b/client/deps/glbench/src.orig/egl_stuff.cc
similarity index 100%
rename from client/site_tests/gl_Bench/src/egl_stuff.cc
rename to client/deps/glbench/src.orig/egl_stuff.cc
diff --git a/client/site_tests/gl_Bench/src/glx_stuff.cc b/client/deps/glbench/src.orig/glx_stuff.cc
similarity index 100%
rename from client/site_tests/gl_Bench/src/glx_stuff.cc
rename to client/deps/glbench/src.orig/glx_stuff.cc
diff --git a/client/site_tests/gl_Bench/src/image.yuv b/client/deps/glbench/src.orig/image.yuv
similarity index 100%
rename from client/site_tests/gl_Bench/src/image.yuv
rename to client/deps/glbench/src.orig/image.yuv
Binary files differ
diff --git a/client/site_tests/gl_Bench/src/main.cc b/client/deps/glbench/src.orig/main.cc
similarity index 100%
rename from client/site_tests/gl_Bench/src/main.cc
rename to client/deps/glbench/src.orig/main.cc
diff --git a/client/site_tests/gl_Bench/src/main.h b/client/deps/glbench/src.orig/main.h
similarity index 100%
rename from client/site_tests/gl_Bench/src/main.h
rename to client/deps/glbench/src.orig/main.h
diff --git a/client/site_tests/gl_Bench/src/shaders.cc b/client/deps/glbench/src.orig/shaders.cc
similarity index 100%
rename from client/site_tests/gl_Bench/src/shaders.cc
rename to client/deps/glbench/src.orig/shaders.cc
diff --git a/client/site_tests/gl_Bench/src/shaders.h b/client/deps/glbench/src.orig/shaders.h
similarity index 100%
rename from client/site_tests/gl_Bench/src/shaders.h
rename to client/deps/glbench/src.orig/shaders.h
diff --git a/client/site_tests/gl_Bench/src/utils.cc b/client/deps/glbench/src.orig/utils.cc
similarity index 100%
rename from client/site_tests/gl_Bench/src/utils.cc
rename to client/deps/glbench/src.orig/utils.cc
diff --git a/client/site_tests/gl_Bench/src/utils.h b/client/deps/glbench/src.orig/utils.h
similarity index 100%
rename from client/site_tests/gl_Bench/src/utils.h
rename to client/deps/glbench/src.orig/utils.h
diff --git a/client/site_tests/gl_Bench/src/xlib_window.cc b/client/deps/glbench/src.orig/xlib_window.cc
similarity index 100%
rename from client/site_tests/gl_Bench/src/xlib_window.cc
rename to client/deps/glbench/src.orig/xlib_window.cc
diff --git a/client/site_tests/gl_Bench/src/xlib_window.h b/client/deps/glbench/src.orig/xlib_window.h
similarity index 100%
rename from client/site_tests/gl_Bench/src/xlib_window.h
rename to client/deps/glbench/src.orig/xlib_window.h
diff --git a/client/site_tests/gl_Bench/src/yuv2rgb.h b/client/deps/glbench/src.orig/yuv2rgb.h
similarity index 100%
rename from client/site_tests/gl_Bench/src/yuv2rgb.h
rename to client/deps/glbench/src.orig/yuv2rgb.h
diff --git a/client/site_tests/gl_Bench/src/yuv2rgb_1.glslf b/client/deps/glbench/src.orig/yuv2rgb_1.glslf
similarity index 100%
rename from client/site_tests/gl_Bench/src/yuv2rgb_1.glslf
rename to client/deps/glbench/src.orig/yuv2rgb_1.glslf
diff --git a/client/site_tests/gl_Bench/src/yuv2rgb_1.glslv b/client/deps/glbench/src.orig/yuv2rgb_1.glslv
similarity index 100%
rename from client/site_tests/gl_Bench/src/yuv2rgb_1.glslv
rename to client/deps/glbench/src.orig/yuv2rgb_1.glslv
diff --git a/client/site_tests/gl_Bench/src/yuv2rgb_2.glslf b/client/deps/glbench/src.orig/yuv2rgb_2.glslf
similarity index 100%
rename from client/site_tests/gl_Bench/src/yuv2rgb_2.glslf
rename to client/deps/glbench/src.orig/yuv2rgb_2.glslf
diff --git a/client/site_tests/gl_Bench/src/yuv2rgb_2.glslv b/client/deps/glbench/src.orig/yuv2rgb_2.glslv
similarity index 100%
rename from client/site_tests/gl_Bench/src/yuv2rgb_2.glslv
rename to client/deps/glbench/src.orig/yuv2rgb_2.glslv
diff --git a/client/site_tests/gl_Bench/gl_Bench.py b/client/site_tests/gl_Bench/gl_Bench.py
index f827115..56cab63 100644
--- a/client/site_tests/gl_Bench/gl_Bench.py
+++ b/client/site_tests/gl_Bench/gl_Bench.py
@@ -12,13 +12,15 @@
preserve_srcdir = True
def setup(self):
- os.chdir(self.srcdir)
- utils.system('make clean')
- utils.system('make')
+ self.job.setup_dep(['glbench'])
def run_once(self, options=''):
- exefile = os.path.join(self.bindir, 'gl_Bench')
+ dep = 'glbench'
+ dep_dir = os.path.join(self.autodir, 'deps', dep)
+ self.job.install_pkg(dep, 'dep', dep_dir)
+
+ exefile = os.path.join(self.autodir, 'deps/glbench/glbench')
cmd = "X :1 & sleep 1; DISPLAY=:1 %s %s; kill $!" % (exefile, options)
self.results = utils.system_output(cmd, retain_output=True)