Blaine Garst | 86d0ba4 | 2010-08-04 23:34:21 +0000 | [diff] [blame] | 1 | // |
| 2 | // The LLVM Compiler Infrastructure |
| 3 | // |
| 4 | // This file is distributed under the University of Illinois Open Source |
| 5 | // License. See LICENSE.TXT for details. |
| 6 | |
| 7 | // |
| 8 | // testfilerunner.h |
| 9 | // testObjects |
| 10 | // |
| 11 | // Created by Blaine Garst on 9/24/08. |
| 12 | // |
| 13 | |
| 14 | #import <Cocoa/Cocoa.h> |
| 15 | |
| 16 | /* |
| 17 | variations: |
| 18 | four source types: C, ObjC, C++, ObjC++, |
| 19 | and for ObjC or ObjC++ we have |
| 20 | RR and GC capabilities |
| 21 | we assume C++ friendly includes for C/ObjC even if C++ isn't used |
| 22 | |
| 23 | |
| 24 | four compilers: C, ObjC, C++, ObjC++ |
| 25 | and for ObjC or ObjC++ we can compile |
| 26 | RR, RR+GC, GC+RR, GC |
| 27 | although to test RR+GC we need to build a shell "main" in both modes |
| 28 | and/or run with GC disabled if possible. |
| 29 | |
| 30 | To maximize coverage we mark files with capabilities and then ask them to be |
| 31 | compiled with each variation of compiler and option. |
| 32 | If the file doesn't have the capability it politely refuses. |
| 33 | */ |
| 34 | |
| 35 | enum options { |
| 36 | Do64 = (1 << 0), |
| 37 | DoCPP = (1 << 1), |
| 38 | DoOBJC = (1 << 3), |
| 39 | DoGC = (1 << 4), |
| 40 | DoRR = (1 << 5), |
| 41 | DoRRGC = (1 << 6), // -fobjc-gc but main w/o so it runs in RR mode |
| 42 | DoGCRR = (1 << 7), // -fobjc-gc & run GC mode |
| 43 | |
| 44 | //DoDashG = (1 << 8), |
| 45 | DoDashO = (1 << 9), |
| 46 | DoDashOs = (1 << 10), |
| 47 | DoDashO2 = (1 << 11), |
| 48 | |
| 49 | DoC99 = (1 << 12), // -std=c99 |
| 50 | }; |
| 51 | |
| 52 | |
| 53 | @class TestFileExeGenerator; |
| 54 | |
| 55 | // this class will actually compile and/or run a target binary |
| 56 | // XXX we don't track which dynamic libraries requested/used nor set them up |
| 57 | @interface TestFileExe : NSObject { |
| 58 | NSPointerArray *compileLine; |
| 59 | int options; |
| 60 | bool shouldFail; |
| 61 | TestFileExeGenerator *generator; |
| 62 | __strong char *binaryName; |
| 63 | __strong char *sourceName; |
| 64 | __strong char *libraryPath; |
| 65 | __strong char *frameworkPath; |
| 66 | } |
| 67 | @property int options; |
| 68 | @property(assign) NSPointerArray *compileLine; |
| 69 | @property(assign) TestFileExeGenerator *generator; |
| 70 | @property bool shouldFail; |
| 71 | @property __strong char *binaryName; |
| 72 | @property __strong char *sourceName; |
| 73 | @property __strong char *libraryPath; |
| 74 | @property __strong char *frameworkPath; |
| 75 | - (bool) compileUnlessExists:(bool)skip; |
| 76 | - (bool) run; |
| 77 | @property(readonly) __strong char *radar; |
| 78 | @end |
| 79 | |
| 80 | // this class generates an appropriate set of configurations to compile |
| 81 | // we don't track which gcc we use but we should XXX |
| 82 | @interface TestFileExeGenerator : NSObject { |
| 83 | bool hasObjC; |
| 84 | bool hasRR; |
| 85 | bool hasGC; |
| 86 | bool hasCPlusPlus; |
| 87 | bool wantsC99; |
| 88 | bool wants64; |
| 89 | bool wants32; |
| 90 | bool supposedToNotCompile; |
| 91 | bool open; // this problem is still open - e.g. unresolved |
| 92 | __strong char *radar; // for things already known to go wrong |
| 93 | __strong char *filename; |
| 94 | __strong char *compilerPath; |
| 95 | __strong char *errorString; |
| 96 | __strong char *warningString; |
| 97 | NSPointerArray *extraLibraries; |
| 98 | } |
| 99 | @property bool hasObjC, hasRR, hasGC, hasCPlusPlus, wantsC99, supposedToNotCompile, open, wants32, wants64; |
| 100 | @property(assign) __strong char *radar; |
| 101 | @property __strong char *filename; |
| 102 | @property __strong char *compilerPath; |
| 103 | @property __strong char *errorString; |
| 104 | @property __strong char *warningString; |
| 105 | - (TestFileExe *)lineForOptions:(int)options; // nil if no can do |
| 106 | + (NSArray *)generatorsFromFILE:(FILE *)fd; |
| 107 | + (NSArray *)generatorsFromPath:(NSString *)path; |
| 108 | @end |
| 109 | |
| 110 | |