当前位置:首页 > 报告详情

潘泳权wpac-应用waPC (rust) 做软件测试工具.pptx

上传人: 2*** 编号:132092 2023-06-30 30页 2.50MB

1、第三届中国第三届中国Rust开发者大会开发者大会应用应用waPC(rust)做软件测试工具做软件测试工具Alan poon 潘泳权大家好!rustropy_gamingruito_89PhoTto/image/chartWebassembly Procedures CallwaPC 协议标准化了本机代码调用 WebAssembly 和 WebAssembly 调用本机代码的通信通信(messaging)和错误错误处理处理(error handling)。什么是waPC?WASM外部函数接口 FFIInput type Return typePlatform底层底层I32I32Unknownwa

2、PC&u8ResultVec,errorLinux x86_64,macOS x86_64,Windows x86_64,cargo build target wasm-unknown-unknownwaPC Host(Go)waPC Guest RustRead wasm fileSelect engineWazeroWasmer-goWasmertime-goDefine hostcall capabilityInstantiateInvoke-command with dataGuest 指wasmOperation是我们要在wasm里注册命名以数据的长度,设置wasm 的linear

3、memory 的指针Guest可执行任务Guest也可返回请求hostInvoke(ctx,operation,payload)WAPC 流程Uses Length of response and error to return resultres,err:=InvokeWAPC 流程#no_manglepub fn wapc_init()wapc:register_function(ping,ping);fn ping(msg:&u8)-wapc:CallResult.Ok(msg.to_vec()waPC Guest RustwaPCUse wapc_init to register fu

4、nctionRegister_function can only be used inside WAPC_initRegister_function cannot be called inside ping_start is meant to support tinygos wasmwaPC host will still run both wapc_init and _start during intializationwaPC Guest RustwaPC Use wapc_init to register function _start also canUtil Lib uses wap

5、c_init,users build on top of”_start”extern crate wapc_guest as guest;extern crate Regex;.fn echo_req_json(msg:&u8)-CallResult let mut req=foo_unmarshall:(msg)?;let re=Regex:new(r”/v2/matches/(a-zA-Z0-9_-+)/info).unwrap();if let Some(cap)=re.captures(&req.HttpPath)req.HttpProxyUrl=String:from(“localh

6、ost:8000);req.HttpScheme=String:from(http);let request=serde_json:to_string(&req)?;Ok(request.as_bytes().to_vec()fn do_nothing(msg:&u8)-CallResult Ok(msg.to_vec()#no_manglepub extern C fn _start()let mut reg=REGISTRY.lock().unwrap();reg.insert(“/v2/matches/.*/info_modify_req”.into(),echo_req_json);r

word格式文档无特别注明外均可编辑修改,预览文件经过压缩,下载原文更清晰!
三个皮匠报告文库所有资源均是客户上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作商用。
本文主要介绍了使用Rust编程语言开发的一款软件测试工具——waPC(WebAssembly Procedures Call)协议。该工具能够模拟数据、自动化测试,支持HTTP/HTTPS/TCP/WebSocket(MITM)等协议。waPC协议标准化了本机代码调用WebAssembly和WebAssembly调用本机代码的通信和错误处理。文章中提到了使用Rust的优势,包括支持多种编程语言、不会耗尽内存、测试用例间的隔离性等。同时,还介绍了如何使用该工具进行自动化HTTP请求、模拟数据规则、AB测试等。该工具可应用于大公司的API测试,解决升级公共库不一致的问题,以及由编程语言引起的高维护成本问题。
"Rust开发者大会有哪些亮点?" "如何使用Rust进行WebAssembly的测试?" "waPC协议在软件测试中的优势是什么?"
客服
商务合作
小程序
服务号
折叠