Skip to content

Add simple kotlin, swift and python integration tests#215

Merged
notmandatory merged 1 commit intobitcoindevkit:masterfrom
notmandatory:add_test_fixtures
Oct 27, 2022
Merged

Add simple kotlin, swift and python integration tests#215
notmandatory merged 1 commit intobitcoindevkit:masterfrom
notmandatory:add_test_fixtures

Conversation

@notmandatory
Copy link
Copy Markdown
Member

@notmandatory notmandatory commented Oct 21, 2022

Description

Add simple kotlin, swift and python integration tests. These tests confirm fixes in #216 and #214.

Notes to the reviewers

To skip integration tests use:

cargo test --lib.

Otherwise java, kotlin, swift, and python need to be installed, and you must run tests with:

CLASSPATH=./tests/jna/jna-5.8.0.jar cargo test

Changelog notice

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • I've added tests to reproduce the issue which are now passing

@notmandatory notmandatory self-assigned this Oct 21, 2022
@notmandatory notmandatory added the CI Continuous integration pipeline related label Oct 21, 2022
@notmandatory notmandatory added this to the Release 0.11.0 milestone Oct 21, 2022
@notmandatory notmandatory force-pushed the add_test_fixtures branch 7 times, most recently from 439d502 to 96d5c15 Compare October 21, 2022 20:04
@notmandatory notmandatory changed the title Add simple kotlin and swift integration tests Add simple kotlin, swift and python integration tests Oct 21, 2022
@notmandatory notmandatory marked this pull request as ready for review October 21, 2022 20:32
@logosstone
Copy link
Copy Markdown
Contributor

Hi @notmandatory
When I ran the command CLASSPATH=./tests/jna/jna-5.8.0.jar cargo test the error below was received .

running 3 tests
test uniffi_foreign_language_testcase_test_kts ...     Finished dev [unoptimized + debuginfo] target(s) in 0.17s
warning: classpath entry points to a non-existent location: ./test/jna/jna-5.8.0.jar
error: warnings found and -Werror specified
Error: running `kotlinc` failed
FAILED
test uniffi_foreign_language_testcase_test_py ... 

This a link to the full log error on a hackmd .
bdk-ffi-pr205-errorlog

@thunderbiscuit
Copy link
Copy Markdown
Member

@waterst0ne from your log in the link I think you're calling the tests with a classpath that has a typo: you're using

CLASSPATH=./test/jna/...

instead of

CLASSPATH=./tests/jna/

Let me know if that fixes it.

@thunderbiscuit
Copy link
Copy Markdown
Member

thunderbiscuit commented Oct 26, 2022

The Kotlin and Python tests work for me, and I assume the Swift ones would as well but I'm running into a Rosetta/M1 issue. Here is my error:

ld: warning: ignoring file /Users/user0/repos/bdk-ffi/target/debug/libbdkffi.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

I've had problems with this before where the terminal is using Rosetta so it thinks it's in an x86_64 but then you compile something and that does its work on the arm64 architecture and you get these errors. It's clear it's one of those, but I'm not sure how to get it to work. In any case I can comment out the Swift test and it runs fine, and since the primary purpose of this is to run in the CI, I think it should be fine.

Example of problem outlined here. Using two toolchains at once unknowingly (homebrew and xcode).

@logosstone
Copy link
Copy Markdown
Contributor

@waterst0ne from your log in the link I think you're calling the tests with a classpath that has a typo: you're using

CLASSPATH=./test/jna/...

instead of

CLASSPATH=./tests/jna/

Let me know if that fixes it.

That seemed to fix it and pass the integration tests but generated some warnings on two machines.
Ubuntu 22.04 vm . x86_64 GNU/LINUX
MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0 x86_64

The warnings are

---------------------------------
Ran 2 tests in 0.000s

OK
test uniffi_foreign_language_testcase_test_py ... ok
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1569:13: warning: keyword 'index' does not need to be escaped in argument list
            `index`: FfiConverterUInt32.read(from: buf), 
            ^     ~
                  
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1570:13: warning: keyword 'address' does not need to be escaped in argument list
            `address`: FfiConverterString.read(from: buf)
            ^       ~
                    
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1639:13: warning: keyword 'immature' does not need to be escaped in argument list
            `immature`: FfiConverterUInt64.read(from: buf), 
            ^        ~
                     
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1640:13: warning: keyword 'trustedPending' does not need to be escaped in argument list
            `trustedPending`: FfiConverterUInt64.read(from: buf), 
            ^              ~
                           
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1641:13: warning: keyword 'untrustedPending' does not need to be escaped in argument list
            `untrustedPending`: FfiConverterUInt64.read(from: buf), 
            ^                ~
                             
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1642:13: warning: keyword 'confirmed' does not need to be escaped in argument list
            `confirmed`: FfiConverterUInt64.read(from: buf), 
            ^         ~
                      
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1643:13: warning: keyword 'spendable' does not need to be escaped in argument list
            `spendable`: FfiConverterUInt64.read(from: buf), 
            ^         ~
                      
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1644:13: warning: keyword 'total' does not need to be escaped in argument list
            `total`: FfiConverterUInt64.read(from: buf)
            ^     ~
                  
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1693:13: warning: keyword 'height' does not need to be escaped in argument list
            `height`: FfiConverterUInt32.read(from: buf), 
            ^      ~
                   
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1694:13: warning: keyword 'timestamp' does not need to be escaped in argument list
            `timestamp`: FfiConverterUInt64.read(from: buf)
            ^         ~
                      
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1757:13: warning: keyword 'url' does not need to be escaped in argument list
            `url`: FfiConverterString.read(from: buf), 
            ^   ~
                
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1758:13: warning: keyword 'socks5' does not need to be escaped in argument list
            `socks5`: FfiConverterOptionString.read(from: buf), 
            ^      ~
                   
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1759:13: warning: keyword 'retry' does not need to be escaped in argument list
            `retry`: FfiConverterUInt8.read(from: buf), 
            ^     ~
                  
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1760:13: warning: keyword 'timeout' does not need to be escaped in argument list
            `timeout`: FfiConverterOptionUInt8.read(from: buf), 
            ^       ~
                    
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1761:13: warning: keyword 'stopGap' does not need to be escaped in argument list
            `stopGap`: FfiConverterUInt64.read(from: buf)
            ^       ~
                    
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1827:13: warning: keyword 'baseUrl' does not need to be escaped in argument list
            `baseUrl`: FfiConverterString.read(from: buf), 
            ^       ~
                    
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1828:13: warning: keyword 'proxy' does not need to be escaped in argument list
            `proxy`: FfiConverterOptionString.read(from: buf), 
            ^     ~
                  
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1829:13: warning: keyword 'concurrency' does not need to be escaped in argument list
            `concurrency`: FfiConverterOptionUInt8.read(from: buf), 
            ^           ~
                        
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1830:13: warning: keyword 'stopGap' does not need to be escaped in argument list
            `stopGap`: FfiConverterUInt64.read(from: buf), 
            ^       ~
                    
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1831:13: warning: keyword 'timeout' does not need to be escaped in argument list
            `timeout`: FfiConverterOptionUInt64.read(from: buf)
            ^       ~
                    
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1891:13: warning: keyword 'outpoint' does not need to be escaped in argument list
            `outpoint`: FfiConverterTypeOutPoint.read(from: buf), 
            ^        ~
                     
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1892:13: warning: keyword 'txout' does not need to be escaped in argument list
            `txout`: FfiConverterTypeTxOut.read(from: buf), 
            ^     ~
                  
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1893:13: warning: keyword 'keychain' does not need to be escaped in argument list
            `keychain`: FfiConverterTypeKeychainKind.read(from: buf), 
            ^        ~
                     
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1894:13: warning: keyword 'isSpent' does not need to be escaped in argument list
            `isSpent`: FfiConverterBool.read(from: buf)
            ^       ~
                    
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1941:13: warning: keyword 'txid' does not need to be escaped in argument list
            `txid`: FfiConverterString.read(from: buf), 
            ^    ~
                 
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1942:13: warning: keyword 'vout' does not need to be escaped in argument list
            `vout`: FfiConverterUInt32.read(from: buf)
            ^    ~
                 
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1970:13: warning: keyword 'script' does not need to be escaped in argument list
            `script`: FfiConverterTypeScript.read(from: buf), 
            ^      ~
                   
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:1971:13: warning: keyword 'amount' does not need to be escaped in argument list
            `amount`: FfiConverterUInt64.read(from: buf)
            ^      ~
                   
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2016:13: warning: keyword 'path' does not need to be escaped in argument list
            `path`: FfiConverterString.read(from: buf), 
            ^    ~
                 
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2017:13: warning: keyword 'treeName' does not need to be escaped in argument list
            `treeName`: FfiConverterString.read(from: buf)
            ^        ~
                     
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2056:13: warning: keyword 'path' does not need to be escaped in argument list
            `path`: FfiConverterString.read(from: buf)
            ^    ~
                 
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2118:13: warning: keyword 'fee' does not need to be escaped in argument list
            `fee`: FfiConverterOptionUInt64.read(from: buf), 
            ^   ~
                
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2119:13: warning: keyword 'received' does not need to be escaped in argument list
            `received`: FfiConverterUInt64.read(from: buf), 
            ^        ~
                     
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2120:13: warning: keyword 'sent' does not need to be escaped in argument list
            `sent`: FfiConverterUInt64.read(from: buf), 
            ^    ~
                 
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2121:13: warning: keyword 'txid' does not need to be escaped in argument list
            `txid`: FfiConverterString.read(from: buf), 
            ^    ~
                 
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2122:13: warning: keyword 'confirmationTime' does not need to be escaped in argument list
            `confirmationTime`: FfiConverterOptionTypeBlockTime.read(from: buf)
            ^                ~
                             
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2153:13: warning: keyword 'psbt' does not need to be escaped in argument list
            `psbt`: FfiConverterTypePartiallySignedBitcoinTransaction.read(from: buf), 
            ^    ~
                 
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2154:13: warning: keyword 'transactionDetails' does not need to be escaped in argument list
            `transactionDetails`: FfiConverterTypeTransactionDetails.read(from: buf)
            ^                  ~
                               
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2199:13: warning: keyword 'value' does not need to be escaped in argument list
            `value`: FfiConverterUInt64.read(from: buf), 
            ^     ~
                  
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2200:13: warning: keyword 'address' does not need to be escaped in argument list
            `address`: FfiConverterString.read(from: buf)
            ^       ~
                    
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2268:13: warning: keyword 'config' does not need to be escaped in argument list
            `config`: try FfiConverterTypeElectrumConfig.read(from: buf)
            ^      ~
                   
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2272:13: warning: keyword 'config' does not need to be escaped in argument list
            `config`: try FfiConverterTypeEsploraConfig.read(from: buf)
            ^      ~
                   
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2319:13: warning: keyword 'config' does not need to be escaped in argument list
            `config`: try FfiConverterTypeSledDbConfiguration.read(from: buf)
            ^      ~
                   
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:2323:13: warning: keyword 'config' does not need to be escaped in argument list
            `config`: try FfiConverterTypeSqliteDbConfiguration.read(from: buf)
            ^      ~
                   
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:3041:21: warning: keyword 'progress' does not need to be escaped in argument list
                    `progress`:  try FfiConverterFloat.read(from: reader), 
                    ^        ~
                             
/Users/NEWAGAIN/sob_main/bdk-ffi/target/debug/bdk.swift:3042:21: warning: keyword 'message' does not need to be escaped in argument list
                    `message`:  try FfiConverterOptionString.read(from: reader)
                    ^       ~

@thunderbiscuit
Copy link
Copy Markdown
Member

Yeah I think those are simply the Swift compiler warnings to help clarify that the backticks are not required. But uniffi-rs puts them there for all languages I think, so that you don't have any surprises.

ACK ee6ee81.

@notmandatory
Copy link
Copy Markdown
Member Author

notmandatory commented Oct 26, 2022

Yes those swift warnings are expected and unfortunately no way to disable certain warnings in swift. Also I get the same swift error with the M1 macOS .. but works with x86 macOS or Linux (which is what CI is using).

@logosstone
Copy link
Copy Markdown
Contributor

Yes those swift warnings are expected and unfortunately no way to disable certain warnings in swift. Also I get the same swift error with the M1 macOS .. but works with x86 macOS or Linux (which is what CI is using).

Ack #ee6ee8139afd74c858216ed99ffdec92dc101787

Yeah I think those are simply the Swift compiler warnings to help clarify that the backticks are not required. But uniffi-rs puts them there for all languages I think, so that you don't have any surprises.

ACK ee6ee81.

Yes those swift warnings are expected and unfortunately no way to disable certain warnings in swift. Also I get the same swift error with the M1 macOS .. but works with x86 macOS or Linux (which is what CI is using).

ACK ee6ee81.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous integration pipeline related

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants