Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NativeCall issue exposed by Audio::Convert::Samplerate #2687

Closed
jonathanstowe opened this issue Feb 9, 2019 · 7 comments

Comments

Projects
None yet
3 participants
@jonathanstowe
Copy link
Contributor

commented Feb 9, 2019

The Problem

Audio::Convert::Samplerate has started failing its tests as per perl6/ecosystem-unbitrot#555

@AlexDaniel has bisected this to ada116e

Expected Behavior

Tests should pass (and did last few weeks https://travis-ci.org/jonathanstowe/Audio-Convert-Samplerate/builds/478720750)

Actual Behavior

Tests fail. Removing the lives-ok from around the failing line gives:

Can only store CArray attribute in CArray slot in CStruct
  in submethod BUILD at /home/jonathan/devel/perl6/modules/Audio-Convert-Samplerate/lib/Audio/Convert/Samplerate.pm (Audio::Convert::Samplerate) line 213
  in method process at /home/jonathan/devel/perl6/modules/Audio-Convert-Samplerate/lib/Audio/Convert/Samplerate.pm (Audio::Convert::Samplerate) line 310
  in method process-other at /home/jonathan/devel/perl6/modules/Audio-Convert-Samplerate/lib/Audio/Convert/Samplerate.pm (Audio::Convert::Samplerate) line 323
  in method process at /home/jonathan/devel/perl6/modules/Audio-Convert-Samplerate/lib/Audio/Convert/Samplerate.pm (Audio::Convert::Samplerate) line 336
  in method process-array at /home/jonathan/devel/perl6/modules/Audio-Convert-Samplerate/lib/Audio/Convert/Samplerate.pm (Audio::Convert::Samplerate) line 342
  in method process-int at /home/jonathan/devel/perl6/modules/Audio-Convert-Samplerate/lib/Audio/Convert/Samplerate.pm (Audio::Convert::Samplerate) line 352
  in block  at t/020-process.t line 175
  in block <unit> at t/020-process.t line 22

https://github.com/jonathanstowe/Audio-Convert-Samplerate/blob/master/lib/Audio/Convert/Samplerate.pm#L212

Which is the binding of a CArray value to a CArray attribute.

Steps to Reproduce

Running the tests of the module suffice but it golfs to:

use NativeCall;
  
class Data is repr('CStruct') {
    has CArray[num32] $.data-in;

    submethod BUILD(CArray :$data-in) {
        $!data-in := $data-in;
    }
}


my $d = Data.new(data-in => CArray[num32].new);

Environment

  • Operating system:

Linux coriolanus 4.20.5-100.fc28.x86_64 #1 SMP Mon Jan 28 19:29:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

  • Compiler version (perl6 -v):

This is Rakudo version 2018.12-293-gd904b7048 built on MoarVM version 2018.12-94-g2eab275df
implementing Perl 6.d.

@jonathanstowe

This comment has been minimized.

Copy link
Contributor Author

commented Feb 10, 2019

BTW I'm actually surprised there isn't a test for this as it is fairly fundamental to the way NativeCall is described to work https://docs.perl6.org/language/nativecall#Structs

@AlexDaniel AlexDaniel changed the title NativeCall issue exposed by Audio::Convert::SampleRate NativeCall issue exposed by Audio::Convert::Samplerate Feb 12, 2019

@AlexDaniel

This comment has been minimized.

Copy link
Member

commented Feb 12, 2019

See #2681

@lizmat

This comment has been minimized.

Copy link
Contributor

commented Feb 12, 2019

Fixed with 5e5c909

@AlexDaniel AlexDaniel added tests needed and removed BLOCKER labels Feb 12, 2019

@lizmat

This comment has been minimized.

Copy link
Contributor

commented Feb 12, 2019

Really fixed with 30fc514

@jonathanstowe

This comment has been minimized.

Copy link
Contributor Author

commented Feb 12, 2019

The above snippet with a lives-ok round it would work as a simple test ;-)

@jonathanstowe

This comment has been minimized.

Copy link
Contributor Author

commented Feb 12, 2019

Confirmed okay:

jns:~/me/Perl6-Modules/Audio-Convert-Samplerate$ perl6 -v
This is Rakudo version 2018.12-296-g30fc5146c built on MoarVM version 2018.12-94-g2eab275df
implementing Perl 6.d.
jns:~/me/Perl6-Modules/Audio-Convert-Samplerate$ zef test . --debug
===> Testing: Audio::Convert::Samplerate:ver<0.0.8>:auth<github:jonathanstowe>:api<1.0>
Testing with plugin: Zef::Service::TAP+{<anon|1>}
t/001-meta.t ......... ok
t/001-use.t .......... ok
# testing with samplerate version libsamplerate.0.1.9.c.2002.2008.Erik.de.Castro.Lopo
t/010-constructor.t .. ok
t/020-process.t ...... ok
All tests successful.
Files=4, Tests=222,  3 wallclock secs
Result: PASS
===> Testing [OK] for Audio::Convert::Samplerate:ver<0.0.8>:auth<github:jonathanstowe>:api<1.0>
@lizmat

This comment has been minimized.

Copy link
Contributor

commented Feb 12, 2019

Test added with bfadefa

@lizmat lizmat closed this Feb 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.