zephyriot / zephyr-issues

0 stars 0 forks source link

samples/net: the HTTP client sample app must run on QEMU x86 #1720

Closed nashif closed 7 years ago

nashif commented 7 years ago

Reported by jiequan wu:

I created a prj_qemu_x86.conf file to test http_client sample app on Qemu x86. prj_qemu_x86.conf: {code} CONFIG_NETWORKING=y
CONFIG_NET_TCP=y CONFIG_RANDOM_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_LOG=y CONFIG_SYS_LOG_NET_BUF_LEVEL=2 CONFIG_SYS_LOG_NET_LEVEL=2 CONFIG_NET_BUF_LOG=y CONFIG_NET_SLIP_TAP=y CONFIG_INIT_STACKS=y CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_PRINTK=y CONFIG_NET_STATISTICS=y

CONFIG_NET_NBUF_RX_COUNT=16 CONFIG_NET_NBUF_TX_COUNT=16 CONFIG_NET_NBUF_DATA_COUNT=16

CONFIG_NET_IPV6_RA_RDNSS=y CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3 CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=2

CONFIG_STDOUT_CONSOLE=y

CONFIG_HTTP_PARSER=y

Enable IPv6 support

CONFIG_NET_IPV6=n

Enable IPv4 support

CONFIG_NET_IPV4=y

CONFIG_NET_SAMPLES_IP_ADDRESSES=y CONFIG_NET_SAMPLES_MY_IPV6_ADDR="2001:db8::1" CONFIG_NET_SAMPLES_PEER_IPV6_ADDR="2001:db8::2" CONFIG_NET_SAMPLES_MY_IPV4_ADDR="192.0.2.1" CONFIG_NET_SAMPLES_PEER_IPV4_ADDR="192.0.2.2"

CONFIG_NET_MAX_CONTEXTS=16

CONFIG_MBEDTLS=y CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h" {code} Steps: Open a terminal window and type: ./loop-socat.sh Open another terminal window and type: sudo ./loop-slip-tap.sh cd samples/net/http_client make pristine && make BOARD=qemu_x86 run

Qemu output and building with some warnings: {code} /home/linux/latest/zephyr.latest/samples/net/http_client/src/http_client.c: In function ‘http_send_request’: /home/linux/latest/zephyr.latest/samples/net/http_client/src/http_client.c:98:32: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=] "\r\nContent-Length: %u\r\n\r\n", ^ CC src/http_client_rcv.o CC src/http_client_cb.o /home/linux/latest/zephyr.latest/samples/net/http_client/src/http_client_cb.c: In function ‘on_url’: /home/linux/latest/zephyr.latest/samples/net/http_client/src/http_client_cb.c:19:17: warning: field precision specifier ‘.’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=] printf("URL: %.s\n", length, at); ^ /home/linux/latest/zephyr.latest/samples/net/http_client/src/http_client_cb.c: In function ‘on_header_field’: /home/linux/latest/zephyr.latest/samples/net/http_client/src/http_client_cb.c:52:12: warning: field precision specifier ‘.’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=] printf("%.s: ", length, at); ^ /home/linux/latest/zephyr.latest/samples/net/http_client/src/http_client_cb.c: In function ‘on_header_value’: /home/linux/latest/zephyr.latest/samples/net/http_client/src/http_client_cb.c:81:12: warning: field precision specifier ‘.’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=] printf("%.s\n", length, at); ^ LD src/built-in.o AR libzephyr.a LINK zephyr.lnk SIDT staticIdt.o LINK zephyr.elf BIN zephyr.bin To exit from QEMU enter: 'CTRL+a, x' [QEMU] CPU: qemu32 qemu-system-i386: warning: Unknown firmware file in legacy mode: genroms/multiboot.bin

{code}

(Imported from Jira ZEP-1872)

nashif commented 7 years ago

by Flavio Santes:

Thanks for reporting, this issue is only seen when building for QEMU and we already solve it:

https://gerrit.zephyrproject.org/r/#/c/12045/ https://gerrit.zephyrproject.org/r/#/c/12046/ https://gerrit.zephyrproject.org/r/#/c/12047/

nashif commented 7 years ago

by Flavio Santes:

I am going to change this from "Bug" to "Story" because the original requirement was to support only the FRDM K64F board.

nashif commented 7 years ago

by Sharron LIU:

This issue also indicate sample apps configure missing. Please address the necessity to have one configure for each board.

nashif commented 7 years ago

by jiequan wu:

Flavio Santes, I tested it on v1.7-rc4(commit id 3d2893cf85d5). Qemu output:

/home/linux/latest/zephyr.latest/samples/net/http_client/src/http_client.c: In function ‘http_send_request’:
/home/linux/latest/zephyr.latest/samples/net/http_client/src/http_client.c:98:32: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
          "\r\nContent-Length: %u\r\n\r\n",
                                ^
  CC      src/http_client_rcv.o
  CC      src/http_client_cb.o
  LD      src/built-in.o
  AR      libzephyr.a
  LINK    zephyr.lnk
  SIDT    staticIdt.o
  LINK    zephyr.elf
  BIN     zephyr.bin
To exit from QEMU enter: 'CTRL+a, x'
[QEMU] CPU: qemu32
qemu-system-i386: warning: Unknown firmware file in legacy mode: genroms/multiboot.bin

And the http_client seems to still does not work on Qemu.

nashif commented 7 years ago

by Flavio Santes:

jiequan wu : patches were sent to the net branch. For 1.7-rc4, the patches must be cherry picked by the maintainer. Test again in net and let me know. Thanks.

nashif commented 7 years ago

by Kuo-Lang Tseng:

jiequan wu , I just cherry-picked the related patches Flavio Santes mentioned to 1.7 branch. Will ping to get them merged.

nashif commented 7 years ago

by Kuo-Lang Tseng:

https://gerrit.zephyrproject.org/r/#/c/12156/ https://gerrit.zephyrproject.org/r/#/c/12157/ https://gerrit.zephyrproject.org/r/#/c/12158/

nashif commented 7 years ago

by Kuo-Lang Tseng:

The above cherrpicks were merged to 1.7 branch. jiequan wu , can you please verify? Thanks.

nashif commented 7 years ago

by jiequan wu:

I tested on master branch(commit c2cc5f90e2), it is fine.

nashif commented 7 years ago

by jiequan wu:

Kuo-Lang Tseng, I tested it on v1.7.0(commit id: bdc3107d5). This issue still exist.

nashif commented 7 years ago

by jiequan wu:

I saw the patch: https://gerrit.zephyrproject.org/r/#/c/12158/ was missing in v1.7.0(commit id: bdc3107d5).

nashif commented 7 years ago

by Kuo-Lang Tseng:

jiequan wu , that's right. That patch didn't get merged to 1.7 branch so it is not part of 1.7 release. Since 1.7 is already released, it's no point to keep the pending patch there so I abandoned it. Since the fix was already merged to master branch, it should work on master for future releases.