1// Copyright 2021 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package mk2rbc 16 17import ( 18 "path/filepath" 19 "reflect" 20 "testing" 21) 22 23func TestProductsMakefile(t *testing.T) { 24 testDir := getTestDirectory() 25 abspath := func(relPath string) string { return filepath.Join(testDir, relPath) } 26 actualProducts := make(map[string]string) 27 if err := UpdateProductConfigMap(actualProducts, abspath("android_products.mk.test")); err != nil { 28 t.Fatal(err) 29 } 30 expectedProducts := map[string]string{ 31 "aosp_cf_x86_tv": abspath("vsoc_x86/tv/device.mk"), 32 "aosp_tv_arm64": abspath("aosp_tv_arm64.mk"), 33 } 34 if !reflect.DeepEqual(actualProducts, expectedProducts) { 35 t.Errorf("\nExpected: %v\n Actual: %v", expectedProducts, actualProducts) 36 } 37} 38