Skip to content

Commit

Permalink
Microsoft broke windows32 env variable setting (#104)
Browse files Browse the repository at this point in the history
* Microsoft broke windows32 env variable setting

* export ucupu before testing

* are bash/powershell split still necessary?

* Properly assert the size of TaskNode on 32-bit

* always set ucpu + use azure agent interpolation

* fix expected taskNode size

* previous commit also switched to stable by mistake (thanks copy-pasting)

* fighting against CI is really hell

* display ucpu to debug Linux 32bit

* try to export ucpu

* display gcc version for debuging linux 32bit

* add missing ARCH: x86 to Linux32 test

* Linux 32-bit actually requires more work to add -m32 to nim csources

* Comment out win32 test. Now mingw-w64 does not find the SynchronizationBarrier symbols (previous $PATH priority was wrong?)
  • Loading branch information
mratsim authored Feb 5, 2020
1 parent 94c81ad commit bf0227c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Weave, a state-of-the-art multithreading runtime
[![Build Status: Travis](https://img.shields.io/travis/com/mratsim/weave/master?label=Travis%20%28Linux%20x86_64%2FARM64%29)](https://travis-ci.com/mratsim/weave)
[![Build Status: Azure](https://img.shields.io/azure-devops/build/numforge/69bc2700-4fa7-4292-a0b3-331ddb721640/2/master?label=Azure%20%28C%2FC%2B%2B%2C%20Linux%2032-bit%2F64-bit%2C%20Windows%2032-bit%2F64-bit%2C%20MacOS%2064-bit%29)](https://dev.azure.com/numforge/Weave/_build?definitionId=2&branchName=master)
[![Build Status: Azure](https://img.shields.io/azure-devops/build/numforge/69bc2700-4fa7-4292-a0b3-331ddb721640/2/master?label=Azure%20%28C%2FC%2B%2B%2C%20Linux%2064-bit%2C%20Windows%2064-bit%2C%20MacOS%2064-bit%29)](https://dev.azure.com/numforge/Weave/_build?definitionId=2&branchName=master)

[![License: Apache](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
Expand Down
79 changes: 36 additions & 43 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,56 @@
strategy:
maxParallel: 10
matrix:
# Nim requires enforcing ARCH="x86" and ucpu
# for 32-bit targets as it seems like Azure machines are 64-bit
# TODO: C++ is allowed to fail
# Nim doesn't compile pledges properly in C++ mode
Windows_devel_32bit:
VM: 'windows-latest'
ARCH: x86
ucpu: i686
PLATFORM: x86
CHANNEL: devel
WEAVE_TEST_LANG: c
# TODO: Nim doesn't compile pledges properly in C++ mode
# TODO: Windows 32-bit requires EnterSynchronizationBarrier support in mingw-w64
# TODO: Linux 32-bit requires gcc -m32 setup

# Windows_devel_32bit:
# VM: 'windows-latest'
# ARCH: x86
# UCPU: i686
# PLATFORM: x86
# CHANNEL: devel
# TEST_LANG: c
Windows_devel_64bit:
VM: 'windows-latest'
UCPU: amd64
PLATFORM: x64
CHANNEL: devel
WEAVE_TEST_LANG: c
TEST_LANG: c
# Windows_cpp_devel_64bit:
# VM: 'windows-latest'
# UCPU: amd64
# PLATFORM: x64
# CHANNEL: devel
# WEAVE_TEST_LANG: cpp
# TEST_LANG: cpp
Linux_devel_64bit:
VM: 'ubuntu-16.04'
UCPU: amd64
PLATFORM: x64
CHANNEL: devel
WEAVE_TEST_LANG: c
TEST_LANG: c
# Linux_cpp_devel_64bit:
# VM: 'ubuntu-16.04'
# UCPU: amd64
# PLATFORM: x64
# CHANNEL: devel
# WEAVE_TEST_LANG: cpp
Linux_devel_32bit:
VM: 'ubuntu-16.04'
PLATFORM: x86
ucpu: i686
CHANNEL: devel
WEAVE_TEST_LANG: c

# Linux_devel_32bit:
# VM: 'ubuntu-16.04'
# ARCH: x86
# PLATFORM: x86
# UCPU: i686
# CHANNEL: devel
# TEST_LANG: c

MacOS_devel_64bit:
VM: 'macOS-10.14'
UCPU: amd64
PLATFORM: x64
CHANNEL: devel
WEAVE_TEST_LANG: c

TEST_LANG: c
pool:
vmImage: $(VM)

Expand Down Expand Up @@ -113,6 +120,9 @@ steps:
- bash: |
echo "PATH=${PATH}"
gcc -v
echo "UCPU=${UCPU}"
if [ "${CHANNEL}" = stable ]; then
BRANCH="v$(curl https://nim-lang.org/channels/stable)"
else
Expand All @@ -126,7 +136,7 @@ steps:
git clone --depth 1 https://github.com/nim-lang/csources csources/
pushd csources
make -j $ncpu CC=gcc
make -j $ncpu ucpu=${UCPU} CC=gcc
popd
rm -rf csources
bin/nim c koch
Expand All @@ -143,34 +153,17 @@ steps:
fi
popd # exit nim-CHANNEL
popd # exit NimBinaries
echo "##vso[task.prependpath]$PWD/NimBinaries/nim-${CHANNEL}/bin"
displayName: 'Building Nim'
# Nimble uses findExe which is broken under bash windows
# We need to set PATH in the collector for the next tast
# and also update it within this task with export
- bash: |
echo "##vso[task.prependpath]$PWD/NimBinaries/nim-${CHANNEL}/bin"
displayName: 'Set env variable (Posix)'
condition: ne(variables['Agent.OS'], 'Windows_NT')
- bash: |
echo "PATH=${PATH}"
nimble refresh
nimble install cligen synthesis
displayName: 'Building the package dependencies (Posix)'
condition: ne(variables['Agent.OS'], 'Windows_NT')
- powershell: |
echo "##vso[task.prependpath]$pwd\NimBinaries\nim-$(CHANNEL)\bin"
displayName: 'Set env variable (Windows)'
condition: eq(variables['Agent.OS'], 'Windows_NT')
- powershell: |
echo $Env:Path
nimble refresh
nimble install cligen synthesis
displayName: 'Building the package dependencies (Windows)'
condition: eq(variables['Agent.OS'], 'Windows_NT')
displayName: 'Building the package dependencies'
- bash: |
echo "PATH=${PATH}"
export ucpu=${UCPU}
nimble test
displayName: 'Testing the package'
4 changes: 2 additions & 2 deletions weave.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ proc test(flags, path: string) =

# Compilation language is controlled by WEAVE_TEST_LANG
var lang = "c"
if existsEnv"WEAVE_TEST_LANG":
lang = getEnv"WEAVE_TEST_LANG"
if existsEnv"TEST_LANG":
lang = getEnv"TEST_LANG"

echo "\n========================================================================================"
echo "Running [", flags, "] ", path
Expand Down
6 changes: 5 additions & 1 deletion weave/channels/pledges.nim
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,11 @@ macro delayedUntilMulti*(task: Task, pool: var TLPoolAllocator, pledges: varargs
# Sanity checks
# ------------------------------------------------------------------------------

assert sizeof(default(TaskNode)[]) == 40,
when sizeof(pointer) == 8:
let expectedSize = 40
else:
let expectedSize = 20
assert sizeof(default(TaskNode)[]) == expectedSize,
"TaskNode size was " & $sizeof(default(TaskNode)[])

assert sizeof(ChannelMpscUnboundedBatch[TaskNode]) == 128,
Expand Down

0 comments on commit bf0227c

Please sign in to comment.