summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2015-03-18 17:09:44 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2015-03-18 17:22:03 -0700
commitd21dca769c4e44482f7d6119d8aae54515063c53 (patch)
treeb27818063201c1cef18be79881faa4e2f8d33ce0
parentcbe189fdd77e5231076b45476d7585e29f5595f1 (diff)
run.c: Add an option to fake a particular platform
Reviewed-by: Matt Turner <mattst88@gmail.com>
-rw-r--r--run.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/run.c b/run.c
index 8628f71..49b2ca3 100644
--- a/run.c
+++ b/run.c
@@ -253,11 +253,50 @@ abort_handler(int signo)
_exit(-1);
}
+struct platform {
+ const char *name;
+ const char *pci_id;
+};
+
+struct const platform platforms[] = {
+ "i965", "0x2A02",
+ "g4x", "0x2A42",
+ "ilk", "0x0042",
+ "snb", "0x0126",
+ "ivb", "0x016a",
+ "hsw", "0x0D2E",
+ "byt", "0x0F33",
+ "bdw", "0x162E",
+};
+
int
main(int argc, char **argv)
{
+ if (argc >= 2 && strcmp(argv[1], "-p") == 0) {
+ struct platform *platform;
+ for (unsigned i = 0; i < ARRAY_SIZE(platforms); i++) {
+ if (strcmp(argv[2], platforms[i].name) == 0) {
+ platform = platforms + i;
+ break;
+ }
+ }
+
+ if (platform == NULL) {
+ fprintf(stderr, "Invalid platform.\nValid platforms are:");
+ for (unsigned i = 0; i < ARRAY_SIZE(platforms); i++)
+ fprintf(stderr, " %s", platforms[i].name);
+ fprintf(stderr, "\n");
+ return -1;
+ }
+
+ printf("### Running faked as %s ###\n", platform->name);
+ setenv("INTEL_DEVID_OVERRIDE", platform->pci_id, 1);
+ argv += 2;
+ argc -= 2;
+ }
+
if (unlikely(argc < 2)) {
- fprintf(stderr, "Usage: %s <directories and *.shader_test files>\n",
+ fprintf(stderr, "Usage: %s [-p <platform>] <directories and *.shader_test files>\n",
argv[0]);
return -1;
}