From 4d30fa93ba80591d5d23cbd1627cc774ddf72351 Mon Sep 17 00:00:00 2001 From: Yu-Chen Lin Date: Sat, 26 Jan 2019 20:04:39 +0800 Subject: [PATCH 1/2] tests: fix test_control_event_serialize commit fefb9816a changed the protocol, fix the related testing case. Signed-off-by: Yu-Chen Lin --- app/tests/test_control_event_serialize.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/tests/test_control_event_serialize.c b/app/tests/test_control_event_serialize.c index 21d7909b..f6034370 100644 --- a/app/tests/test_control_event_serialize.c +++ b/app/tests/test_control_event_serialize.c @@ -87,13 +87,13 @@ static void test_serialize_mouse_event(void) { unsigned char buf[SERIALIZED_EVENT_MAX_SIZE]; int size = control_event_serialize(&event, buf); - assert(size == 14); + assert(size == 18); const unsigned char expected[] = { 0x02, // CONTROL_EVENT_TYPE_MOUSE 0x00, // AKEY_EVENT_ACTION_DOWN 0x00, 0x00, 0x00, 0x01, // AMOTION_EVENT_BUTTON_PRIMARY - 0x01, 0x04, 0x04, 0x02, // 260 1026 + 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x04, 0x02, // 260 1026 0x04, 0x38, 0x07, 0x80, // 1080 1920 }; assert(!memcmp(buf, expected, sizeof(expected))); @@ -120,11 +120,11 @@ static void test_serialize_scroll_event(void) { unsigned char buf[SERIALIZED_EVENT_MAX_SIZE]; int size = control_event_serialize(&event, buf); - assert(size == 17); + assert(size == 21); const unsigned char expected[] = { 0x03, // CONTROL_EVENT_TYPE_SCROLL - 0x01, 0x04, 0x04, 0x02, // 260 1026 + 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x04, 0x02, // 260 1026 0x04, 0x38, 0x07, 0x80, // 1080 1920 0x00, 0x00, 0x00, 0x01, // 1 0xFF, 0xFF, 0xFF, 0xFF, // -1 From eea478b9dc357561ae10f2937985402d374d6dc1 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 26 Jan 2019 15:24:37 +0100 Subject: [PATCH 2/2] Add release script Add a script to generate the whole release properly. It first builds locally in release mode, then execute tests. Then it builds archives for Windows. Finally, it puts all release files (Windows archives, prebuilt server and checksums) in a separate release directory. --- Makefile.CrossWindows | 2 +- release.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 release.sh diff --git a/Makefile.CrossWindows b/Makefile.CrossWindows index 99a35cab..0f7b14a6 100644 --- a/Makefile.CrossWindows +++ b/Makefile.CrossWindows @@ -34,7 +34,7 @@ WIN32_TARGET := $(WIN32_TARGET_DIR)-$(VERSION).zip WIN64_TARGET := $(WIN64_TARGET_DIR)-$(VERSION).zip release: clean zip-win32 zip-win64 sums - @echo "Release created in $(DIST)/." + @echo "Windows archives generated in $(DIST)/" clean: $(GRADLE) clean diff --git a/release.sh b/release.sh new file mode 100755 index 00000000..ca632e00 --- /dev/null +++ b/release.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -e + +# build and test locally +BUILDDIR=build_release +rm -rf "$BUILDDIR" +meson "$BUILDDIR" --buildtype release --strip -Db_lto=true +cd "$BUILDDIR" +ninja +ninja test +cd - + +# build Windows releases +make -f Makefile.CrossWindows + +# the generated server must be the same everywhere +cmp "$BUILDDIR/server/scrcpy-server.jar" dist/scrcpy-win32/scrcpy-server.jar +cmp "$BUILDDIR/server/scrcpy-server.jar" dist/scrcpy-win64/scrcpy-server.jar + +# get version name +TAG=$(git describe --tags --always) + +# create release directory +mkdir -p "release-$TAG" +cp "$BUILDDIR/server/scrcpy-server.jar" "release-$TAG/scrcpy-server-$TAG.jar" +cp "dist/scrcpy-win32-$TAG.zip" "release-$TAG/" +cp "dist/scrcpy-win64-$TAG.zip" "release-$TAG/" + +# generate checksums +cd "release-$TAG" +sha256sum "scrcpy-server-$TAG.jar" \ + "scrcpy-win32-$TAG.zip" \ + "scrcpy-win64-$TAG.zip" > SHA256SUMS.txt + +echo "Release generated in release-$TAG/"