OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include <v8.h> | 28 #include <v8.h> |
29 #include <cstdlib> | 29 #include <cstdlib> |
30 #include <cstring> | 30 #include <cstring> |
31 #include <cstdio> | 31 #include <cstdio> |
32 #include "cctest.h" | 32 #include "cctest.h" |
33 | 33 |
34 | 34 |
35 CcTest* CcTest::last_ = NULL; | 35 CcTest* CcTest::last_ = NULL; |
36 | 36 |
37 | 37 |
38 CcTest::CcTest(TestFunction* callback, const char* file, | 38 CcTest::CcTest(TestFunction* callback, const char* file, const char* name, |
39 const char* name, bool enabled) | 39 const char* dependency, bool enabled) |
40 : callback_(callback), name_(name), prev_(last_) { | 40 : callback_(callback), name_(name), dependency_(dependency), prev_(last_) { |
41 // Find the base name of this test (const_cast required on Windows). | 41 // Find the base name of this test (const_cast required on Windows). |
42 char *basename = strrchr(const_cast<char *>(file), '/'); | 42 char *basename = strrchr(const_cast<char *>(file), '/'); |
43 if (!basename) { | 43 if (!basename) { |
44 basename = strrchr(const_cast<char *>(file), '\\'); | 44 basename = strrchr(const_cast<char *>(file), '\\'); |
45 } | 45 } |
46 if (!basename) { | 46 if (!basename) { |
47 basename = v8::internal::OS::StrDup(file); | 47 basename = v8::internal::OS::StrDup(file); |
48 } else { | 48 } else { |
49 basename = v8::internal::OS::StrDup(basename + 1); | 49 basename = v8::internal::OS::StrDup(basename + 1); |
50 } | 50 } |
51 // Drop the extension, if there is one. | 51 // Drop the extension, if there is one. |
52 char *extension = strrchr(basename, '.'); | 52 char *extension = strrchr(basename, '.'); |
53 if (extension) *extension = 0; | 53 if (extension) *extension = 0; |
54 // Install this test in the list of tests | 54 // Install this test in the list of tests |
55 file_ = basename; | 55 file_ = basename; |
56 enabled_ = enabled; | 56 enabled_ = enabled; |
57 prev_ = last_; | 57 prev_ = last_; |
58 last_ = this; | 58 last_ = this; |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 static void PrintTestList(CcTest* current) { | 62 static void PrintTestList(CcTest* current) { |
63 if (current == NULL) return; | 63 if (current == NULL) return; |
64 PrintTestList(current->prev()); | 64 PrintTestList(current->prev()); |
65 printf("%s/%s\n", current->file(), current->name()); | 65 if (current->dependency() != NULL) { |
| 66 printf("%s/%s<%s\n", current->file(), current->name(), current->dependency()
); |
| 67 } else { |
| 68 printf("%s/%s<\n", current->file(), current->name()); |
| 69 } |
66 } | 70 } |
67 | 71 |
68 | 72 |
69 int main(int argc, char* argv[]) { | 73 int main(int argc, char* argv[]) { |
70 v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); | 74 v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); |
71 int tests_run = 0; | 75 int tests_run = 0; |
72 bool print_run_count = true; | 76 bool print_run_count = true; |
73 for (int i = 1; i < argc; i++) { | 77 for (int i = 1; i < argc; i++) { |
74 char* arg = argv[i]; | 78 char* arg = argv[i]; |
75 if (strcmp(arg, "--list") == 0) { | 79 if (strcmp(arg, "--list") == 0) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 test = test->prev(); | 114 test = test->prev(); |
111 } | 115 } |
112 } | 116 } |
113 free(arg_copy); | 117 free(arg_copy); |
114 } | 118 } |
115 } | 119 } |
116 if (print_run_count && tests_run != 1) | 120 if (print_run_count && tests_run != 1) |
117 printf("Ran %i tests.\n", tests_run); | 121 printf("Ran %i tests.\n", tests_run); |
118 return 0; | 122 return 0; |
119 } | 123 } |
OLD | NEW |