Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
50 changes: 50 additions & 0 deletions .github/actions/setup-wsl-runner/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Setup Windows WSL Runner
description: 'Setup a WSL Runner for building and testing Erlang/OTP'

inputs:
installer_name:
default: false
github_token:
description: 'GITHUB_TOKEN'
default: '${{ github.token }}'

runs:
using: composite
steps:
- name: Set timezone to CET
shell: cmd
run: tzutil /s "W. Europe Standard Time"

- uses: Vampire/setup-wsl@v3.1.3
with:
distribution: Ubuntu-18.04

- name: Install WSL dependencies
shell: wsl-bash {0}
run: apt update && apt install -y make autoconf unzip zip

- name: Download source archive
uses: actions/download-artifact@v4.1.8
with:
name: otp_prebuilt

- name: Download installer
if: inputs.installer_name != 'false'
uses: actions/download-artifact@v4.1.8
with:
name: otp_win32_installer

- name: Download tests
if: inputs.installer_name != 'false'
uses: actions/download-artifact@v4.1.8
with:
name: otp_tests

- name: Install OTP
if: inputs.installer_name != 'false'
shell: cmd
run: |
echo %cd%
start "" /WAIT ${{ inputs.installer_name }} /S /D=%CD%\release\win32\
dir %cd%
dir %cd%\release\win32\
163 changes: 147 additions & 16 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
name: Build and check Erlang/OTP

on:
push:
#push:
pull_request:
schedule:
- cron: 0 1 * * *
Expand Down Expand Up @@ -278,22 +278,24 @@ jobs:
path: otp/liberlang.xcframework

build-windows:
name: Build Erlang/OTP (Windows)
needs: pack
if: needs.pack.outputs.c-code-changes
runs-on: windows-2022
defaults:
run:
shell: wsl-bash {0}
env:
WXWIDGETS_VERSION: 3.2.6
name: Build Erlang/OTP (Windows)
runs-on: windows-2022
needs: pack
if: needs.pack.outputs.c-code-changes
outputs:
installer_name: ${{ steps.compile-erlang.outputs.installer_name }}

steps:
- uses: Vampire/setup-wsl@5ff2c045a05fd477a71b5419d50c5a228a52468e # ratchet:Vampire/setup-wsl@v4.1.0
with:
distribution: Ubuntu-18.04

- name: Install WSL dependencies
run: apt update && apt install -y g++-mingw-w64 gcc-mingw-w64 make autoconf unzip
- name: Setup nl behaviour for wsl
shell: cmd
run: git config --global core.autocrlf input
- uses: actions/checkout@v4.2.1
- uses: ./.github/actions/setup-wsl-runner

- name: Install openssl
shell: cmd
Expand Down Expand Up @@ -349,6 +351,9 @@ jobs:
name: otp_prebuilt

- name: Compile Erlang
id: compile-erlang
env:
WSLENV: GITHUB_OUTPUT/p
run: |
mkdir -p /mnt/c/opt/local64/pgm/
cp -R wxWidgets /mnt/c/opt/local64/pgm/wxWidgets-${{ env.WXWIDGETS_VERSION }}
Expand All @@ -368,15 +373,24 @@ jobs:
fi
./otp_build boot -a
./otp_build release -a
cp /mnt/c/opt/local64/pgm/wxWidgets-${{ env.WXWIDGETS_VERSION }}/3rdparty/webview2/runtimes/win-x64/native/WebView2Loader.dll $ERL_TOP/release/win32/erts-*/bin/
./otp_build debuginfo_win32
./otp_build installer_win32
echo "installer_name=$(ls release/win32/otp*.exe | xargs basename)" >> $GITHUB_OUTPUT
make release_tests
zip -r tests.zip release/tests

- name: Upload installer
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # ratchet:actions/upload-artifact@v4.6.0
with:
name: otp_win32_installer
path: otp/release/win32/otp*.exe

- name: Upload tests
uses: actions/upload-artifact@v4.4.0
with:
name: otp_tests
path: otp/tests.zip

build-flavors:
name: Build Erlang/OTP (Types and Flavors)
runs-on: ubuntu-latest
Expand Down Expand Up @@ -493,6 +507,123 @@ jobs:
- name: Run dialyzer
run: docker run -v $PWD/:/github otp '/github/scripts/run-dialyzer'

test-windows:
name: Test Win64 Erlang/OTP
needs: [pack, build-windows]
defaults:
run:
shell: wsl-bash {0}
runs-on: windows-2022
if: needs.pack.outputs.changes != '[]'
strategy:
matrix:
type: ${{ fromJson(needs.pack.outputs.all) }}
# type: ${{ fromJson(needs.pack.outputs.changes) }}
# type: ["os_mon","sasl"]
fail-fast: false
steps:
- name: Setup nl behaviour for wsl
shell: cmd
run: git config --global core.autocrlf input
- uses: actions/checkout@v4.2.1
- uses: ./.github/actions/setup-wsl-runner
with:
installer_name: ${{ needs.build-windows.outputs.installer_name }}

- name: Run tests
id: run-tests
run: |
set -x
unzip -q tests.zip
export ERL_TOP="$(pwd)"
export MAKEFLAGS=-j$(($(nproc) + 2))

eval `./otp_build env_win32 x64`

export PATH=`pwd`/release/win32/bin/:$PATH

APP="${{ matrix.type }}"
TYPE=opt
## Need to specialize for epmd, emulator and debug
case "${APP}" in
debug)
echo "No debug tests on windows"
;;
*)
(cd release/tests/test_server && erl.exe -env USER ${USER} -emu_type $TYPE -noinput -eval "ts:install()" -eval "ts:run($APP,[batch])" -s init stop)
if grep "^=result[ ]*failed:" release/tests/test_server/ct_run.*/tests.${APP}_test.logs/run*/suite.log; then
exit 1
fi
;;
esac

- name: Cleanup tests
if: ${{ !cancelled() && matrix.type != 'debug' }}
run: tar czf ${{ matrix.type }}_win32_test_results.tar.gz release/tests/test_server
- name: Upload test results
uses: actions/upload-artifact@v4.4.0
if: ${{ !cancelled() && matrix.type != 'debug' }}
with:
name: ${{ matrix.type }}_win32_test_results
path: ${{ matrix.type }}_win32_test_results.tar.gz

system-test-windows:
name: Test Win64 Erlang/OTP (system)
defaults:
run:
shell: wsl-bash {0}
runs-on: windows-2022
if: ${{ !cancelled() }} # Run even if the need has failed
needs: [test-windows, build-windows]
steps:
- name: Setup nl behaviour for wsl
shell: cmd
run: git config --global core.autocrlf input
- uses: actions/checkout@v4.2.1
- uses: ./.github/actions/setup-wsl-runner
with:
installer_name: ${{ needs.build-windows.outputs.installer_name }}

- name: Download test results
uses: actions/download-artifact@v4.1.8
- name: Merge test results
run: |
shopt -s nullglob
for file in *_win32_test_results/*.tar.gz; do
tar xvzf $file
done
export PATH=`pwd`/release/win32/bin/:$PATH
cd release/tests/test_server && ct_run.exe -noshell -refresh_logs $(wslpath -w `pwd`)

- name: Run system tests
run: |
set -x
unzip -q -o tests.zip

export ERL_TOP="$(pwd)/otp"
export MAKEFLAGS=-j$(($(nproc) + 2))

eval `./otp_build env_win32 x64`

export PATH=`pwd`/release/win32/bin/:$PATH

(cd release/tests/test_server && erl.exe -noshell -eval "ts:install()" -eval "ts:run(system,[batch])" -s init stop)
if grep "^=result[ ]*failed:" release/tests/test_server/ct_run.*/tests.system_test.logs/run*/suite.log; then
exit 1
fi

- name: Cleanup tests
if: ${{ !cancelled() }}
run: |
tar czf test_results_win32.tar.gz release/tests/test_server

- name: Upload test results
uses: actions/upload-artifact@v4.4.0
if: ${{ !cancelled() }}
with:
name: test_results_win32
path: test_results_win32.tar.gz

test:
name: Test Erlang/OTP
runs-on: ubuntu-latest
Expand Down Expand Up @@ -544,13 +675,13 @@ jobs:
run: |
rm -rf make_test_dir/otp || true
sudo bash -c "chown -R `whoami` make_test_dir && chmod -R +r make_test_dir"
tar czf ${{ matrix.type }}_test_results.tar.gz make_test_dir
tar czf ${{ matrix.type }}_ubuntu_test_results.tar.gz make_test_dir
- name: Upload test results
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # ratchet:actions/upload-artifact@v4.6.0
if: ${{ !cancelled() }}
with:
name: ${{ matrix.type }}_test_results
path: ${{ matrix.type }}_test_results.tar.gz
name: ${{ matrix.type }}_ubuntu_test_results
path: ${{ matrix.type }}_ubuntu_test_results.tar.gz

system-test:
name: Test Erlang/OTP (system)
Expand All @@ -568,7 +699,7 @@ jobs:
run: |
shopt -s nullglob
mkdir -p make_test_dir
for file in *_test_results/*.tar.gz; do
for file in *_ubuntu_test_results/*.tar.gz; do
tar xzf $file
done
docker run -v $PWD/make_test_dir:/buildroot/otp/erts/make_test_dir otp \
Expand Down
4 changes: 4 additions & 0 deletions erts/emulator/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,10 @@ release_spec: all
$(INSTALL_DATA) $(RELEASE_INCLUDES) "$(RELEASE_PATH)/usr/include"
$(INSTALL_DATA) $(RELEASE_INCLUDES) "$(RELSYSDIR)/include"
$(INSTALL_PROGRAM) $(BINDIR)/$(EMULATOR_EXECUTABLE) "$(RELSYSDIR)/bin"
ifeq ($(TARGET),win32)
$(INSTALL_DATA) $(BINDIR)/$(EMULATOR_EXECUTABLE:.dll=.pdb) "$(RELSYSDIR)/bin"
$(INSTALL_DATA) $(BINDIR)/$(FLAVOR_EXECUTABLE:.dll=.pdb) "$(RELSYSDIR)/bin"
endif
ifeq ($(RELEASE_LIBBEAM),yes)
$(INSTALL_DIR) "$(RELSYSDIR)/lib"
$(INSTALL_PROGRAM) $(BINDIR)/$(EMULATOR_LIB) "$(RELSYSDIR)/lib"
Expand Down
4 changes: 3 additions & 1 deletion erts/emulator/beam/erl_bif_coverage.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ get_cover_id_line(Process* c_p, const BeamCodeHeader* hdr)
for (i = hdr->line_coverage_len - 1; i >= 0; i--) {
Eterm coverage = am_error;
Uint* coverage_array = hdr->coverage;
Sint coverage_data;
unsigned cover_id;

if (!hdr->line_coverage_valid[i]) {
Expand All @@ -388,7 +389,8 @@ get_cover_id_line(Process* c_p, const BeamCodeHeader* hdr)
if (location == LINE_INVALID_LOCATION) {
continue;
}
coverage = make_small(MIN(coverage_array[i], MAX_SMALL));
coverage_data = coverage_array[i];
coverage = make_small(MIN(coverage_data, MAX_SMALL));
cover_id = loc2id[i];
tmp = TUPLE2(hp, make_small(cover_id), coverage);
hp += 3;
Expand Down
10 changes: 5 additions & 5 deletions erts/emulator/test/smoke_test_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,16 @@ native_atomics(Config) when is_list(Config) ->
end.

jump_table(Config) when is_list(Config) ->
case erlang:system_info(beam_jump_table) of
true ->
ok;
false ->
case {erlang:system_info(beam_jump_table),
erlang:system_info(emu_flavor)} of
{false, emu} ->
case erlang:system_info(build_type) of
opt ->
ct:fail(optimized_without_beam_jump_table);
BT ->
{comment, "No beam jump table, but build type is " ++ atom_to_list(BT)}
end
end;
_ -> ok
end.


Expand Down
3 changes: 3 additions & 0 deletions erts/epmd/src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: all
$(INSTALL_DIR) "$(RELEASE_PATH)/erts-$(VSN)/bin"
$(INSTALL_PROGRAM) $(INSTALL_PROGS) "$(RELEASE_PATH)/erts-$(VSN)/bin"
ifeq ($(TARGET),win32)
$(INSTALL_DATA) $(INSTALL_PROGS:.exe=.pdb) "$(RELEASE_PATH)/erts-$(VSN)/bin"
endif


release_docs_spec:
5 changes: 5 additions & 0 deletions erts/etc/common/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ $(OBJDIR)/safe_string.o: $(ETC)/safe_string.c $(RC_GENERATED)
# erl_call
$(BINDIR)/erl_call@EXEEXT@: $(ERL_TOP)/lib/erl_interface/bin/$(TARGET)/erl_call@EXEEXT@
$(ld_verbose)cp $< $@
$(ld_verbose)cp $(<:.exe=.pdb) $(@:.exe=.pdb)

ifneq ($(TARGET),win32)
$(BINDIR)/$(ERLEXEC): $(OBJDIR)/$(ERLEXEC).o $(ERTS_LIB)
Expand Down Expand Up @@ -545,6 +546,10 @@ ifneq ($(TARGET), win32)
endif
ifneq ($(INSTALL_PROGS),)
$(INSTALL_PROGRAM) $(INSTALL_PROGS) "$(RELEASE_PATH)/erts-$(VSN)/bin"
ifeq ($(TARGET),win32)
$(INSTALL_DATA) $(INSTALL_PROGS:.exe=.pdb) "$(RELEASE_PATH)/erts-$(VSN)/bin"
$(INSTALL_DATA) $(INSTALL_PROGS:.dll=.pdb) "$(RELEASE_PATH)/erts-$(VSN)/bin"
endif
endif
ifneq ($(INSTALL_TOP),)
$(INSTALL_SCRIPT) $(INSTALL_TOP) "$(RELEASE_PATH)"
Expand Down
2 changes: 2 additions & 0 deletions erts/etc/win32/wsl_tools/vc/cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ while test -n "$1" ; do
MD=-MD;
fi
OPTIMIZED_BUILD=true;;
-O0)
;;
-O*)
# Optimization hardcoded
OPTIMIZE_FLAGS="-Ox -Z7";
Expand Down
3 changes: 3 additions & 0 deletions erts/lib_src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ INTERNAL_RELEASE_LIBS= \
.PHONY: release_spec
release_spec: all
$(INSTALL_PROGRAM) $(YCF_EXECUTABLE) "$(RELSYSDIR)/bin"
ifeq ($(TARGET),win32)
$(INSTALL_DATA) $(YCF_EXECUTABLE:.exe=.pdb) "$(RELEASE_PATH)/erts-$(VSN)/bin"
endif
ifneq ($(strip $(RELEASE_INCLUDES)),)
$(INSTALL_DIR) "$(RELSYSDIR)/include"
$(INSTALL_DIR) "$(RELEASE_PATH)/usr/include"
Expand Down
3 changes: 2 additions & 1 deletion lib/sasl/src/systools_make.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1589,9 +1589,10 @@ preloaded() ->

erts_binary_filter() ->
Cmds = ["typer", "dialyzer", "ct_run", "yielding_c_fun", "erlc"],
Extensions = [".exe", ".pdb"],
case os:type() of
{unix,_} -> Cmds;
{win32,_} -> [ [Cmd, ".exe"] || Cmd <- Cmds]
{win32,_} -> [ [Cmd, Ext] || Cmd <- Cmds, Ext <- Extensions]
end.

%%______________________________________________________________________
Expand Down
Loading