Get tests building on OS X

This commit is contained in:
Aaron Culliney 2014-06-21 15:01:43 -07:00
parent 6e4b390b0d
commit 3a3219234f
7 changed files with 53 additions and 15 deletions

View File

@ -8,11 +8,11 @@
#import <XCTest/XCTest.h>
@interface Apple2Mac_Tests : XCTestCase
@interface Apple2Mac_CPUTests : XCTestCase
@end
@implementation Apple2Mac_Tests
@implementation Apple2Mac_CPUTests
- (void)setUp
{
@ -26,9 +26,21 @@
[super tearDown];
}
- (void)testExample
extern int test_cpu(int, char **);
- (void)testCPU
{
XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
char *argv[] = {
"-f",
NULL
};
int argc = 0;
for (char **p = &argv[0]; *p != NULL; p++) {
++argc;
}
int val = test_cpu(argc, argv);
XCTAssertEqual(val, 0);
}
@end

View File

@ -13,8 +13,6 @@
7751DD5D1955F567007F8BDF /* Apple2Mac_Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7751DD5C1955F567007F8BDF /* Apple2Mac_Tests.m */; };
7751DD641955F58B007F8BDF /* testcommon.c in Sources */ = {isa = PBXBuildFile; fileRef = 77A916561950108F00F5B902 /* testcommon.c */; };
7751DD651955F596007F8BDF /* testcpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 77A916581950108F00F5B902 /* testcpu.c */; };
7751DD661955F59B007F8BDF /* testvm.c in Sources */ = {isa = PBXBuildFile; fileRef = 77A916601950108F00F5B902 /* testvm.c */; };
7751DD671955F5D7007F8BDF /* testdisplay.c in Sources */ = {isa = PBXBuildFile; fileRef = 77A916591950108F00F5B902 /* testdisplay.c */; };
7751DD69195611A1007F8BDF /* font.c in Sources */ = {isa = PBXBuildFile; fileRef = 7751DD68195611A1007F8BDF /* font.c */; };
7751DD6E1956161C007F8BDF /* darwin-glue.S in Sources */ = {isa = PBXBuildFile; fileRef = 7751DD6D1956161C007F8BDF /* darwin-glue.S */; };
7751DD7119561B4A007F8BDF /* DarwinVideo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7751DD7019561B4A007F8BDF /* DarwinVideo.m */; };
@ -32,6 +30,7 @@
7751DD7D19561DC4007F8BDF /* timing.c in Sources */ = {isa = PBXBuildFile; fileRef = 77A916611950108F00F5B902 /* timing.c */; };
7751DD7E19561DC4007F8BDF /* vm.c in Sources */ = {isa = PBXBuildFile; fileRef = 77A916671950108F00F5B902 /* vm.c */; };
7751DD7F19561DC4007F8BDF /* zlib-helpers.c in Sources */ = {isa = PBXBuildFile; fileRef = 77A9166D1950108F00F5B902 /* zlib-helpers.c */; };
7751DD8519563BDC007F8BDF /* libz.1.1.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 7751DD8419563BDC007F8BDF /* libz.1.1.3.dylib */; };
77A913BE19500F6000F5B902 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77A913BD19500F6000F5B902 /* QuartzCore.framework */; };
77A913C019500F6000F5B902 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77A913BF19500F6000F5B902 /* GLKit.framework */; };
77A913C219500F6000F5B902 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77A913C119500F6000F5B902 /* OpenGL.framework */; };
@ -255,6 +254,7 @@
7751DD6D1956161C007F8BDF /* darwin-glue.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "darwin-glue.S"; sourceTree = "<group>"; };
7751DD6F19561B4A007F8BDF /* DarwinVideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DarwinVideo.h; path = Classes/DarwinVideo.h; sourceTree = "<group>"; };
7751DD7019561B4A007F8BDF /* DarwinVideo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DarwinVideo.m; path = Classes/DarwinVideo.m; sourceTree = "<group>"; };
7751DD8419563BDC007F8BDF /* libz.1.1.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.1.3.dylib; path = usr/lib/libz.1.1.3.dylib; sourceTree = SDKROOT; };
77A913BA19500F6000F5B902 /* Apple2Mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Apple2Mac.app; sourceTree = BUILT_PRODUCTS_DIR; };
77A913BD19500F6000F5B902 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
77A913BF19500F6000F5B902 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; };
@ -677,6 +677,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7751DD8519563BDC007F8BDF /* libz.1.1.3.dylib in Frameworks */,
7751DD551955F567007F8BDF /* XCTest.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -703,6 +704,7 @@
7751DD561955F567007F8BDF /* Apple2Mac Tests */ = {
isa = PBXGroup;
children = (
77A916531950108F00F5B902 /* test */,
7751DD5C1955F567007F8BDF /* Apple2Mac_Tests.m */,
7751DD571955F567007F8BDF /* Supporting Files */,
);
@ -742,6 +744,7 @@
77A913BC19500F6000F5B902 /* Frameworks */ = {
isa = PBXGroup;
children = (
7751DD8419563BDC007F8BDF /* libz.1.1.3.dylib */,
77A913BD19500F6000F5B902 /* QuartzCore.framework */,
77A913BF19500F6000F5B902 /* GLKit.framework */,
77A913C119500F6000F5B902 /* OpenGL.framework */,
@ -1524,7 +1527,6 @@
77A916501950108F00F5B902 /* misc.h */,
77A916511950108F00F5B902 /* prefs.c */,
77A916521950108F00F5B902 /* prefs.h */,
77A916531950108F00F5B902 /* test */,
77A916611950108F00F5B902 /* timing.c */,
77A916621950108F00F5B902 /* timing.h */,
77A916631950108F00F5B902 /* uthash.h */,
@ -1559,7 +1561,8 @@
77A916591950108F00F5B902 /* testdisplay.c */,
77A916601950108F00F5B902 /* testvm.c */,
);
path = test;
name = test;
path = ../../src/test;
sourceTree = "<group>";
};
77A916641950108F00F5B902 /* video */ = {
@ -1731,8 +1734,6 @@
7751DD7D19561DC4007F8BDF /* timing.c in Sources */,
7751DD7E19561DC4007F8BDF /* vm.c in Sources */,
7751DD7F19561DC4007F8BDF /* zlib-helpers.c in Sources */,
7751DD661955F59B007F8BDF /* testvm.c in Sources */,
7751DD671955F5D7007F8BDF /* testdisplay.c in Sources */,
7751DD641955F58B007F8BDF /* testcommon.c in Sources */,
7751DD5D1955F567007F8BDF /* Apple2Mac_Tests.m in Sources */,
7751DD651955F596007F8BDF /* testcpu.c in Sources */,
@ -2209,6 +2210,7 @@
7751DD621955F567007F8BDF /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
77A913B519500F6000F5B902 /* Build configuration list for PBXProject "Apple2Mac" */ = {
isa = XCConfigurationList;

View File

@ -10,6 +10,9 @@
*/
#include "testcommon.h"
#ifdef __APPLE__
#include "darwin-shim.h"
#endif
#define TESTBUF_SZ 1024

View File

@ -15,6 +15,12 @@
#include "common.h"
#include "greatest.h"
#ifdef __APPLE__
#include <CommonCrypto/CommonDigest.h>
#define SHA_DIGEST_LENGTH CC_SHA1_DIGEST_LENGTH
#define SHA1 CC_SHA1
#endif
#define TEST_FINISHED 0xff
#define MIXSWITCH_ADDR 0x1f32 // PEEK(7986) -- NOTE : value is hardcoded in various places
#define WATCHPOINT_ADDR 0x1f33 // PEEK(7987) -- NOTE : value is hardcoded in various places

View File

@ -7732,9 +7732,14 @@ GREATEST_SUITE(test_suite_cpu) {
SUITE(test_suite_cpu);
GREATEST_MAIN_DEFS();
int main(int argc, char **argv) {
int test_cpu(int argc, char **argv) {
GREATEST_MAIN_BEGIN();
RUN_SUITE(test_suite_cpu);
GREATEST_MAIN_END();
}
#if !defined(__APPLE__)
int main(int argc, char **argv) {
test_cpu(argc, argv);
}
#endif

View File

@ -13,7 +13,7 @@
#ifdef HAVE_OPENSSL
#include <openssl/sha.h>
#else
#elif !defined(__APPLE__)
#error "these tests require OpenSSL libraries"
#endif
@ -467,9 +467,14 @@ GREATEST_SUITE(test_suite_display) {
SUITE(test_suite_display);
GREATEST_MAIN_DEFS();
int main(int argc, char **argv) {
int test_display(int argc, char **argv) {
GREATEST_MAIN_BEGIN();
RUN_SUITE(test_suite_display);
GREATEST_MAIN_END();
}
#if !defined(__APPLE__)
int main(int argc, char **argv) {
test_display(argc, argv);
}
#endif

View File

@ -15,7 +15,7 @@
#ifdef HAVE_OPENSSL
#include <openssl/sha.h>
#else
#elif !defined(__APPLE__)
#error "these tests require OpenSSL libraries (SHA)"
#endif
@ -3404,9 +3404,14 @@ GREATEST_SUITE(test_suite_vm) {
SUITE(test_suite_vm);
GREATEST_MAIN_DEFS();
int main(int argc, char **argv) {
int test_vm(int argc, char **argv) {
GREATEST_MAIN_BEGIN();
RUN_SUITE(test_suite_vm);
GREATEST_MAIN_END();
}
#if !defined(__APPLE__)
int main(int argc, char **argv) {
test_vm(argc, argv);
}
#endif