Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Parallel State Machine Testing #28

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7a9bb82
Cooperative Scheduling using fibers.
jeffh Dec 13, 2014
9c09745
Added threads-based scheduler.
jeffh Dec 25, 2014
9a8a440
Deleted Fiber implementation.
jeffh Dec 31, 2014
3bccff3
Deleted FOXLinearizer
jeffh Dec 31, 2014
7795ddb
Added Foxling - a clang proprocessor.
jeffh Jan 6, 2015
579701f
Added basic FoxlingCompiler wrapper.
jeffh Jan 7, 2015
de833cf
Converted some large stack allocations to heap.
jeffh Jan 8, 2015
2095563
Added Clang Compiler Plugin for Xcode.
jeffh Jan 8, 2015
ddb0403
Refactored public API for state machine generation.
jeffh Jan 10, 2015
076fee0
Minor tweaks. Documentation comments
jeffh Jan 10, 2015
f994b9a
Internal refactors.
jeffh Jan 12, 2015
112e14d
Added Foxling tests to script.
jeffh Jan 12, 2015
56137f2
Adding foxling tests to travis would be useful
jeffh Jan 12, 2015
c130752
Added pack/unpack scripts for prebuilt LLVM
jeffh Jan 12, 2015
6e2e4b1
Added ability to download prebuilt LLVM from s3.
jeffh Jan 12, 2015
532af0f
Added Fox-OSX-Specs to shared schemes.
jeffh Jan 12, 2015
deb8625
Disable modules for Foxling. Apple Clang has a custom module implemen…
jeffh Jan 13, 2015
33d8dd5
New state machine test API can pass mutated property results to FOXFo…
jeffh Jan 13, 2015
a8331e7
Fixed occational crash when a thread being scheduled by Fox yields du…
jeffh Jan 13, 2015
1209fac
Code formatting
jeffh Jan 14, 2015
d8c9454
Refactor. Optimize imports and renamed new state machine api
jeffh Jan 14, 2015
22c8c05
Basic layout for parallel tests docs. Updated generator reference
jeffh Jan 14, 2015
ad79281
Added more documentation for paralle testing.
jeffh Jan 15, 2015
42d3188
Small optimization of FOXSequence.
jeffh Jan 18, 2015
a572d34
Fixed FOXBind test to not be flaky.
jeffh Jan 18, 2015
27ee65e
Documentation tweaks. Rewording pass on parallel docs.
jeffh Jan 18, 2015
dad46ef
Fixed hardcoded paths in Foxling.
jeffh Jan 19, 2015
ff0b06c
Fixed analyze warnings.
jeffh Jan 25, 2015
e72fbfb
Sequences and rose trees are encodable and copyable.
jeffh Jan 27, 2015
7868dcc
Removed spec linting (again)
jeffh Feb 4, 2015
ad1dc24
Fixed warnings.
jeffh Feb 5, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ DerivedData/
Pods
.ropeproject
docs/build
Foxling/LLVM/llvm
Foxling/LLVM/llvm_build
Foxling/LLVM/llvm_output
Foxling/LLVM/llvm.tar.gz
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ env:
matrix:
- FOX_RUNTIME_IOS_SDK_VERSION=8.1 TYPE=ios
- FOX_RUNTIME_OSX_SDK_VERSION=10.10 TYPE=osx
- FOX_RUNTIME_OSX_SDK_VERSION=10.10 TYPE=foxling
# - TYPE=podspec

install:
- sudo gem install cocoapods --pre
script:
- ./test clean $TYPE
# - pod spec lint Fox.podspec
10 changes: 10 additions & 0 deletions Fox-OSX-Specs/main.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#import <Cedar.h>
#import <Foundation/Foundation.h>

// Compiling tests as an executable allows for easy
// instrumentation for finding leaks / performance problems.
int main(int argc, const char * argv[]) {
@autoreleasepool {
return CDRRunSpecs();
}
}
706 changes: 694 additions & 12 deletions Fox.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions Fox.xcodeproj/xcshareddata/xcschemes/Fox-OSX-Specs.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1FF4AAAF1A3FD7C10000E69E"
BuildableName = "Fox-OSX-Specs"
BlueprintName = "Fox-OSX-Specs"
ReferencedContainer = "container:Fox.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1FF4AAAF1A3FD7C10000E69E"
BuildableName = "Fox-OSX-Specs"
BlueprintName = "Fox-OSX-Specs"
ReferencedContainer = "container:Fox.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1FF4AAAF1A3FD7C10000E69E"
BuildableName = "Fox-OSX-Specs"
BlueprintName = "Fox-OSX-Specs"
ReferencedContainer = "container:Fox.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "FOX_SEED"
value = "1418723808"
isEnabled = "NO">
</EnvironmentVariable>
<EnvironmentVariable
key = "CEDAR_RANDOM_SEED"
value = "95766"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1FF4AAAF1A3FD7C10000E69E"
BuildableName = "Fox-OSX-Specs"
BlueprintName = "Fox-OSX-Specs"
ReferencedContainer = "container:Fox.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
7 changes: 7 additions & 0 deletions Fox.xcodeproj/xcshareddata/xcschemes/Fox-OSX.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@
ReferencedContainer = "container:Fox.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "FOX_SEED"
value = "1418633993"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
Expand Down
2 changes: 1 addition & 1 deletion Fox.xcodeproj/xcshareddata/xcschemes/Fox-iOS.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
buildConfiguration = "Release"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
Expand Down
3 changes: 3 additions & 0 deletions Fox.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions Fox/Private/Data/FOXArray.h

This file was deleted.

51 changes: 0 additions & 51 deletions Fox/Private/Data/FOXArray.m

This file was deleted.

9 changes: 9 additions & 0 deletions Fox/Private/Data/FOXArraySequence.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#import "FOXSequence.h"

/// Exists mostly to reduce memory footprint.
@interface FOXArraySequence : FOXSequence

- (instancetype)initWithArray:(NSArray *)array;
- (instancetype)initWithArray:(NSArray *)array offset:(NSUInteger)offset;

@end
41 changes: 41 additions & 0 deletions Fox/Private/Data/FOXArraySequence.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#import "FOXArraySequence.h"

@interface FOXArraySequence ()
@property (nonatomic) NSArray *array;
@property (nonatomic) NSUInteger offset;
@property (nonatomic) id<FOXSequence> remainingSequence;
@end

@implementation FOXArraySequence

#pragma mark - Public

- (instancetype)initWithArray:(NSArray *)array
{
return [self initWithArray:array offset:0];
}

- (instancetype)initWithArray:(NSArray *)array offset:(NSUInteger)offset
{
self = [super init];
if (self) {
self.offset = offset;
if (offset < array.count) {
self.array = array;
_count = self.array.count - offset;
}
if (self.offset + 1 < self.array.count) {
self.remainingSequence = [[FOXArraySequence alloc] initWithArray:self.array
offset:self.offset + 1];
}

}
return self;
}

- (id)firstObject
{
return [self.array objectAtIndex:self.offset];
}

@end
11 changes: 11 additions & 0 deletions Fox/Private/Data/FOXAssertionException.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>

@class FOXPropertyResult;

@interface FOXAssertionException : NSException

@property (nonatomic, readonly) FOXPropertyResult *result;

- (instancetype)initWithPropertyResult:(FOXPropertyResult *)result;

@end
20 changes: 20 additions & 0 deletions Fox/Private/Data/FOXAssertionException.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#import "FOXAssertionException.h"

@implementation FOXAssertionException

- (instancetype)initWithPropertyResult:(FOXPropertyResult *)result
{
self = [super initWithName:@"FOXAssertionException"
reason:@"Assertion Failed"
userInfo:@{@"FOXPropertyResult": result}];
if (self) {
}
return self;
}

- (FOXPropertyResult *)result
{
return self.userInfo[@"FOXPropertyResult"];
}

@end
8 changes: 8 additions & 0 deletions Fox/Private/Data/FOXBlock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#import <Foundation/Foundation.h>

@interface FOXBlock : NSObject

- (instancetype)initWithGroup:(dispatch_group_t)group block:(id(^)())block;
- (void)run;

@end
32 changes: 32 additions & 0 deletions Fox/Private/Data/FOXBlock.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#import "FOXBlock.h"
#import "FOXThread.h"

@interface FOXBlock ()
@property (nonatomic) dispatch_group_t group;
@property (atomic, copy) id(^block)();
@property (atomic) id result;
@end


@implementation FOXBlock

- (instancetype)initWithGroup:(dispatch_group_t)group block:(id(^)())block
{
self = [super init];
if (self) {
self.group = group;
self.block = block;
}
return self;
}

- (void)run
{
@autoreleasepool {
fthread_yield();
self.result = self.block();
dispatch_group_leave(self.group);
}
}

@end
2 changes: 2 additions & 0 deletions Fox/Private/Data/FOXConcreteSequence.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ @interface FOXConcreteSequence ()

@implementation FOXConcreteSequence

#pragma mark - Public

- (instancetype)init
{
if (self = [super init]) {
Expand Down
6 changes: 6 additions & 0 deletions Fox/Private/Data/FOXDictionary.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#import <Foundation/Foundation.h>

// A dictionary that simply provides better description output
@interface FOXDictionary : NSDictionary

@end
Loading