blob: d85c2cfa30611d0ca1ce2c989897fd81583e1e90 [file] [log] [blame]
Wink Saville2cfb4502010-07-26 17:00:34 -07001# This has various targets to assist in developing
2# and testing the mock ril. The default "all" target
3# invokes protoc to generate the appropriate protobuf
4# code. The other targest are used for testing.
5
6# Assume this Makefile is run in place then top
7# point to the top of the android source tree
8top=../../../
9
Wink Savillea3260a52010-11-08 19:18:30 -080010PROTOC=$(wildcard $(top)out/host/*/bin/aprotoc)
11#if ((($(words $(PROTO)) != 1)))
12ifneq ($(words $(PROTOC)),1)
13$(error expecting 1 protoc we have $(words $(PROTOC)), PROTOC='$(PROTOC)')
14endif
15
Wink Saville2c1fb3a2011-03-19 13:42:45 -070016ifeq ("$(ANDROID_DEVICE)","")
17$(warning Default to ANDROID_DEVICE=passion")
18ANDROID_DEVICE=passion
19endif
20
Wink Saville52bb1fc2010-07-28 16:44:10 -070021# Directories of source files
Wink Saville2c1fb3a2011-03-19 13:42:45 -070022device=$(ANDROID_DEVICE)
Wink Saville52bb1fc2010-07-28 16:44:10 -070023src_js=src/js
24src_proto=src/proto
Wink Saville2c1fb3a2011-03-19 13:42:45 -070025src_generated=$(top)out/target/product/$(device)/obj/SHARED_LIBRARIES/libmock_ril_intermediates/proto/hardware/ril/mock-ril/src/proto
Wink Saville52bb1fc2010-07-28 16:44:10 -070026
27# Directories of generated source files
Wink Saville52bb1fc2010-07-28 16:44:10 -070028gen_src_py=$(src_generated)/python
29gen_src_desc=$(src_generated)/desc
30
31# Generated files
Wink Savillea3260a52010-11-08 19:18:30 -080032generated=$(gen_src_desc)/msgheader.desc $(gen_src_py)/msgheader_pb2.py \
33 $(gen_src_desc)/ril.desc $(gen_src_py)/ril_pb2.py \
34 $(gen_src_desc)/ctrl.desc $(gen_src_py)/ctrl_pb2.py
Wink Saville52bb1fc2010-07-28 16:44:10 -070035
Wink Saville2cfb4502010-07-26 17:00:34 -070036# A Makefile to run protoc and simplify testing.
Wink Saville3d6d3482010-07-19 20:37:44 -070037.PHONY : all
Wink Saville52bb1fc2010-07-28 16:44:10 -070038all : $(generated)
Wink Saville2cfb4502010-07-26 17:00:34 -070039
40# TODO: Document/cleanup these testing targets as we learn whats needed.
41
42# Make the unit tests
43.PHONY : ut
44ut :
45 source $(top)build/envsetup.sh ; mmm $(top)frameworks/base/telephony/tests/telephonytests
Wink Saville2c1fb3a2011-03-19 13:42:45 -070046 adb install -r $(top)out/target/product/$(device)/data/app/FrameworksTelephonyTests.apk
Wink Saville2cfb4502010-07-26 17:00:34 -070047
Wink Savillea3260a52010-11-08 19:18:30 -080048t : $(gen_src_desc)/msgheader.desc $(gen_src_py)/msgheader_pb2.py
Wink Saville52bb1fc2010-07-28 16:44:10 -070049
Wink Savillea3260a52010-11-08 19:18:30 -080050# Run protoc to create the descriptor files for msgheader
Wink Saville52bb1fc2010-07-28 16:44:10 -070051$(gen_src_desc)/msgheader.desc : $(src_proto)/msgheader.proto
52 mkdir -p $(gen_src_desc)
Wink Savillea3260a52010-11-08 19:18:30 -080053 $(PROTOC) --descriptor_set_out=$@ --proto_path=$(src_proto) --include_imports $<
Wink Saville2cfb4502010-07-26 17:00:34 -070054
Wink Savillea3260a52010-11-08 19:18:30 -080055# Run protoc to create the python files for msgheader
Wink Saville52bb1fc2010-07-28 16:44:10 -070056$(gen_src_py)/msgheader_pb2.py : $(src_proto)/msgheader.proto
57 mkdir -p $(gen_src_py)
Wink Savillea3260a52010-11-08 19:18:30 -080058 $(PROTOC) --python_out=$(gen_src_py) --proto_path=$(src_proto) $<
Wink Saville3d6d3482010-07-19 20:37:44 -070059
Wink Saville2cfb4502010-07-26 17:00:34 -070060# Run protoc to create the ril descriptor file for ril
Wink Saville52bb1fc2010-07-28 16:44:10 -070061$(gen_src_desc)/ril.desc : $(src_proto)/ril.proto
62 mkdir -p $(gen_src_desc)
Wink Savillea3260a52010-11-08 19:18:30 -080063 $(PROTOC) --descriptor_set_out=$@ --proto_path=$(src_proto) --include_imports $<
Wink Saville2cfb4502010-07-26 17:00:34 -070064
Wink Savillea3260a52010-11-08 19:18:30 -080065# Run protoc to create the python files for ril
Wink Saville52bb1fc2010-07-28 16:44:10 -070066$(gen_src_py)/ril_pb2.py : $(src_proto)/ril.proto
67 mkdir -p $(gen_src_py)
Wink Savillea3260a52010-11-08 19:18:30 -080068 $(PROTOC) --python_out=$(gen_src_py) --proto_path=$(src_proto) $<
Wink Saville3d6d3482010-07-19 20:37:44 -070069
Wink Savillea3260a52010-11-08 19:18:30 -080070# Run protoc to create the python files for control
Wink Saville52bb1fc2010-07-28 16:44:10 -070071$(gen_src_py)/ctrl_pb2.py : $(src_proto)/ctrl.proto
72 mkdir -p $(gen_src_py)
Wink Savillea3260a52010-11-08 19:18:30 -080073 $(PROTOC) --python_out=$(gen_src_py) --proto_path=$(top) --proto_path=$(src_proto) $<
Wink Saville3d6d3482010-07-19 20:37:44 -070074
75# Run protoc to create the ctrl descriptor file for control
Wink Saville52bb1fc2010-07-28 16:44:10 -070076$(gen_src_desc)/ctrl.desc : $(src_proto)/ctrl.proto
77 mkdir -p $(gen_src_desc)
Wink Savillea3260a52010-11-08 19:18:30 -080078 $(PROTOC) --descriptor_set_out=$@ --proto_path=$(top) --proto_path=$(src_proto) --include_imports $<
Wink Saville2cfb4502010-07-26 17:00:34 -070079
Wink Saville3d6d3482010-07-19 20:37:44 -070080# After starting phone do this first to get lastest ril.desc/proto and setup rild
81.PHONY : first
Wink Saville2cfb4502010-07-26 17:00:34 -070082first : root_remount copy_all forward
83
84# copy js and descriptors, restart rild and run mockril_tests
85.PHONY : tmr
86tmr : copy_js_desc restart_rild mockril_tests
87
88# Copy all files, restart rild and run mockril_tests
89.PHONY : test
90test : copy_all restart_rild install_mockril_tests mockril_tests
91
92# Restart rild
93.PHONY : restart_rild
94restart_rild :
Wink Savillea3260a52010-11-08 19:18:30 -080095 adb shell setprop ctl.restart ril-daemon
Wink Saville2cfb4502010-07-26 17:00:34 -070096
97# Update only the js/copy and restart rild
98.PHONY : tjs
99tjs : copy_js_desc restart_rild
100
101# Run test control server python script
102.PHONY : tcs
103tcs :
104 ./tcs.py 127.0.0.1 11111
105
106# Run the mock ril tests (use adb shell pm list instrumentation to see the Runner)
107.PHONY : mockril_tests
108mockril_tests :
109 adb shell am instrument -e class 'com.android.internal.telephony.mockril.MockRilTest' -w com.android.frameworks.telephonytests/.TelephonyMockRilTestRunner
110
111# forward the control server tcp port (54312) to a port on the PC side (11111)
112.PHONY : forward
113forward :
114 adb forward tcp:11111 tcp:54312
115
116# change to root and remount device
117.PHONY : root_remount
118root_remount :
Wink Saville3d6d3482010-07-19 20:37:44 -0700119 adb root ; sleep 3 ; adb remount ; adb shell setprop rild.libpath /data/lib/libmock_ril.so
Wink Saville2cfb4502010-07-26 17:00:34 -0700120
121# Copy all files
122.PHONY : copy_all
123copy_all : copy_js_desc copy_mockril
124
125# Copy js and the protobuf descriptor files
126.PHONY : copy_js_desc
127copy_js_desc :
Wink Saville52bb1fc2010-07-28 16:44:10 -0700128 adb push $(src_js)/mock_ril.js /sdcard/data/
Wink Savilled9c8c5f2010-08-12 16:34:07 -0700129 adb push $(src_js)/mock_ril_tests.js /sdcard/data/
Wink Saville52bb1fc2010-07-28 16:44:10 -0700130 adb push $(src_js)/simulated_radio.js /sdcard/data/
Wink Savilled9c8c5f2010-08-12 16:34:07 -0700131 adb push $(src_js)/simulated_radio_tests.js /sdcard/data/
Wink Saville52bb1fc2010-07-28 16:44:10 -0700132 adb push $(src_js)/simulated_icc.js /sdcard/data/
Wink Savilled9c8c5f2010-08-12 16:34:07 -0700133 adb push $(src_js)/simulated_icc_tests.js /sdcard/data/
Wink Saville52bb1fc2010-07-28 16:44:10 -0700134 adb push $(src_js)/ctrl_server.js /sdcard/data/
Wink Savilled9c8c5f2010-08-12 16:34:07 -0700135 adb push $(src_js)/ctrl_server_tests.js /sdcard/data/
Wink Saville52bb1fc2010-07-28 16:44:10 -0700136 adb push $(src_js)/ril_vars.js /sdcard/data/
137 adb push $(gen_src_desc)/ril.desc /sdcard/data/
138 adb push $(gen_src_desc)/ctrl.desc /sdcard/data/
Wink Saville3d6d3482010-07-19 20:37:44 -0700139 adb forward tcp:11111 tcp:54312
140
Wink Saville2c1fb3a2011-03-19 13:42:45 -0700141
Wink Saville2cfb4502010-07-26 17:00:34 -0700142# Copy the mock ril library
143.PHONY : copy_mockril
144copy_mockril :
Wink Saville2c1fb3a2011-03-19 13:42:45 -0700145 adb push $(top)out/target/product/$(device)/system/lib/libmock_ril.so /data/lib/
Wink Saville3d6d3482010-07-19 20:37:44 -0700146
Wink Saville2cfb4502010-07-26 17:00:34 -0700147.PHONY : install_mockril_tests
148install_mockril_tests :
Wink Saville2c1fb3a2011-03-19 13:42:45 -0700149 adb install -r $(top)out/target/product/$(device)/data/app/FrameworksTelephonyTests.apk
Wink Saville3d6d3482010-07-19 20:37:44 -0700150
151# Remove generated files
152.PHONY : clean
153clean :
Wink Saville52bb1fc2010-07-28 16:44:10 -0700154 rm -f $(generated)