Skip to content

Commit

Permalink
chore(bob_toolchain): add tag test case
Browse files Browse the repository at this point in the history
Change-Id: Ifac50926780ef0da23b499bfcfc096a3b6ee1b03
  • Loading branch information
lukokr-aarch64 committed Oct 11, 2023
1 parent cb3fd4b commit 6a711c7
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 1 deletion.
24 changes: 23 additions & 1 deletion gendiffer/tests/toolchain/tagable/app/build.bp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ bob_toolchain {
"-Wall",
"-Werror",
],
tags: ["toolchain"],
tags: [
"toolchain",
"owner:toolchain",
],
target: {

tags: ["target"],
Expand All @@ -17,6 +20,7 @@ bob_toolchain {

tags: ["feature"],
},

}

bob_library {
Expand All @@ -26,3 +30,21 @@ bob_library {
],
toolchain: "main_toolchain",
}

bob_executable {
name: "exe",
srcs: [
"src.c",
],
toolchain: "main_toolchain",
}

bob_test {
name: "test",
srcs: [
"src.c",
],

build_by_default: true,
toolchain: "main_toolchain",
}
22 changes: 22 additions & 0 deletions gendiffer/tests/toolchain/tagable/out/android/Android.bp.out
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,25 @@ genrule {
cmd: "python $(location scripts/verify_hash.py) --hash redacted --out $(out) -- $(in)",
}

cc_binary {
name: "exe",
srcs: ["src.c"],
cflags: [
"-Wall",
"-Werror",
],
compile_multilib: "both",
}

cc_test {
name: "test",
srcs: ["src.c"],
cflags: [
"-Wall",
"-Werror",
],
include_build_directory: false,
auto_gen_config: false,
gtest: false,
}

65 changes: 65 additions & 0 deletions gendiffer/tests/toolchain/tagable/out/linux/build.ninja.out
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ rule g.bob.cc
deps = gcc
description = ${out}

rule g.bob.executable
pool = g.bob.link
command = ${build_wrapper} ${linker} ${in} -o ${out} ${ldflags} ${static_libs} -L${shared_libs_dir} ${shared_libs_flags} ${ldlibs}
description = ${out}

rule g.bob.shared_library
pool = g.bob.link
command = ${build_wrapper} ${linker} -shared ${in} -o ${out} ${ldflags} ${static_libs} -L${shared_libs_dir} ${shared_libs_flags} ${ldlibs}
Expand All @@ -47,6 +52,36 @@ rule g.bootstrap.cp
command = cp ${in} ${out}
description = cp ${out}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Module: exe
# Variant: target
# Type: bob_executable
# Factory: github.com/ARM-software/bob-build/core.Main.func1.1
# Defined: build.bp:redacted

m.exe_target.cflags = -Wall -Werror
m.exe_target.conlyflags =

build ${g.bob.BuildDir}/target/objects/exe/src.c.o: g.bob.cc $
${g.bob.SrcDir}/src.c
build_wrapper =
ccompiler = gcc
cflags = ${m.exe_target.cflags}
conlyflags = ${m.exe_target.conlyflags}

build ${g.bob.BuildDir}/target/executable/exe: g.bob.executable $
${g.bob.BuildDir}/target/objects/exe/src.c.o
build_wrapper =
ldflags = -Wl,--as-needed
ldlibs =
linker = g++
shared_libs_dir = ${g.bob.BuildDir}/target/shared
shared_libs_flags = -Wl,-rpath-link,${g.bob.BuildDir}/target/shared
static_libs =

build exe: phony ${g.bob.BuildDir}/target/executable/exe
default exe

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Module: lib
# Variant: target
Expand Down Expand Up @@ -82,6 +117,36 @@ build ${g.bob.BuildDir}/target/static/lib.a: g.bob.static_library $
build lib: phony ${g.bob.BuildDir}/target/static/lib.a $
${g.bob.BuildDir}/target/shared/lib.so

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Module: test
# Variant: target
# Type: bob_test
# Factory: github.com/ARM-software/bob-build/core.Main.func1.1
# Defined: build.bp:redacted

m.test_target.cflags = -Wall -Werror
m.test_target.conlyflags =

build ${g.bob.BuildDir}/target/objects/test/src.c.o: g.bob.cc $
${g.bob.SrcDir}/src.c
build_wrapper =
ccompiler = gcc
cflags = ${m.test_target.cflags}
conlyflags = ${m.test_target.conlyflags}

build ${g.bob.BuildDir}/target/executable/test: g.bob.executable $
${g.bob.BuildDir}/target/objects/test/src.c.o
build_wrapper =
ldflags = -Wl,--as-needed
ldlibs =
linker = g++
shared_libs_dir = ${g.bob.BuildDir}/target/shared
shared_libs_flags = -Wl,-rpath-link,${g.bob.BuildDir}/target/shared
static_libs =

build test: phony ${g.bob.BuildDir}/target/executable/test
default test

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Singleton: bootstrap
# Factory: github.com/google/blueprint/bootstrap.Main.func4
Expand Down

0 comments on commit 6a711c7

Please sign in to comment.