From 9c2fea67e98f217e1bc717fd9efd232bfee808a0 Mon Sep 17 00:00:00 2001 From: Yuntao Xu Date: Thu, 26 Aug 2021 13:39:49 -0700 Subject: [PATCH] Add the cts-platform-version check Added the cts-platform-version check when the cts directory exists. Bug: 194402596 Test: manually modified the ifeq condition to check error message Test: TreeHugger Change-Id: I613ac5b5014dbf4e6202e1dbd1b6a92359817cf2 --- core/tasks/cts.mk | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/core/tasks/cts.mk b/core/tasks/cts.mk index fdd9591768..dccf14f72b 100644 --- a/core/tasks/cts.mk +++ b/core/tasks/cts.mk @@ -25,3 +25,35 @@ $(call dist-for-goals, cts, $(compatibility_zip)) .PHONY: cts_v2 cts_v2: cts + +# platform version check (b/32056228) +# ============================================================ +ifneq (,$(wildcard cts/)) + cts_platform_version_path := cts/tests/tests/os/assets/platform_versions.txt + cts_platform_version_string := $(shell cat $(cts_platform_version_path)) + cts_platform_release_path := cts/tests/tests/os/assets/platform_releases.txt + cts_platform_release_string := $(shell cat $(cts_platform_release_path)) + + ifeq (,$(findstring $(PLATFORM_VERSION),$(cts_platform_version_string))) + define error_msg + ============================================================ + Could not find version "$(PLATFORM_VERSION)" in CTS platform version file: + $(cts_platform_version_path) + Most likely PLATFORM_VERSION in build/core/version_defaults.mk + has changed and a new version must be added to this CTS file. + ============================================================ + endef + $(error $(error_msg)) + endif + ifeq (,$(findstring $(PLATFORM_VERSION_LAST_STABLE),$(cts_platform_release_string))) + define error_msg + ============================================================ + Could not find version "$(PLATFORM_VERSION_LAST_STABLE)" in CTS platform release file: + $(cts_platform_release_path) + Most likely PLATFORM_VERSION_LAST_STABLE in build/core/version_defaults.mk + has changed and a new version must be added to this CTS file. + ============================================================ + endef + $(error $(error_msg)) + endif +endif