Merge pull request #89 from gnustep/travis-vary-version

Fix CI for runtime ABI 2.0
This commit is contained in:
Fred Kiefer 2019-12-03 08:42:52 +01:00 committed by GitHub
commit 18405b7abb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 6 deletions

View file

@ -1,5 +1,5 @@
language: cpp
dist: trusty
dist: xenial
compiler:
- clang
- gcc
@ -34,7 +34,16 @@ before_install:
fi;
sudo apt-get install -y libobjc-4.8-dev;
else
sudo apt-get install -y libkqueue-dev libpthread-workqueue-dev;
curl -s -o - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -;
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" && sudo apt-get update -qq;
sudo apt-get install -y clang-9 libkqueue-dev libpthread-workqueue-dev;
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 10 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-9;
export PATH=$(echo "$PATH" | sed -e 's/:\/usr\/local\/clang-7.0.0\/bin//');
if [ "$RUNTIME_VERSION" = "gnustep-2.0" ];
then
sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10;
fi;
fi;
install: ./travis-deps.sh
before_script: >
@ -50,5 +59,5 @@ before_script: >
export GNUSTEP_MAKEFILES=$HOME/staging/share/GNUstep/Makefiles;
. $HOME/staging/share/GNUstep/Makefiles/GNUstep.sh;
script: >
./configure $BASE_ABI;
./configure $BASE_ABI || (cat config.log && false);
make && make install && make check || (cat Tests/tests.log && false);

View file

@ -4,10 +4,12 @@
#import <Foundation/NSIndexSet.h>
#import <Foundation/NSString.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSLock.h>
#import <Foundation/NSValue.h>
static NSUInteger fooCount = 0;
static NSUInteger lastIndex = NSNotFound;
static BOOL reverse = NO;
int main()
{
START_SET("NSArray Blocks")
@ -16,10 +18,20 @@ int main()
# endif
# if __has_feature(blocks)
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSLock *lock = [[[NSLock alloc] init] autorelease];
NSArray *array = [NSArray arrayWithObjects: @"foo", @"bar", @"foo", nil];
void(^enumBlock)(id,NSUInteger,BOOL*) = ^(id obj, NSUInteger index, BOOL *stop){
if ([obj isEqual: @"foo"]){ fooCount++;} lastIndex = index;};
void(^enumBlock)(id,NSUInteger,BOOL*) = ^(id obj, NSUInteger index, BOOL *stop) {
[lock lock];
if ([obj isEqual: @"foo"]) {
fooCount++;
}
if (lastIndex == NSNotFound) {
lastIndex = index;
} else {
lastIndex = reverse ? MIN(lastIndex, index) : MAX(lastIndex, index);
}
[lock unlock];
};
[array enumerateObjectsUsingBlock: enumBlock];
PASS((2 == fooCount) && (lastIndex == 2),
"Can forward enumerate array using a block");
@ -31,9 +43,11 @@ int main()
"Can forward enumerate array concurrently using a block");
fooCount = 0;
lastIndex = NSNotFound;
reverse = YES;
[array enumerateObjectsWithOptions: NSEnumerationReverse
usingBlock: enumBlock];
PASS((0 == lastIndex), "Can enumerate array in reverse using a block");
reverse = NO;
fooCount = 0;
lastIndex = NSNotFound;
enumBlock = ^(id obj, NSUInteger index, BOOL *stop){if ([obj isEqual: @"foo"]){