LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-08-2010, 08:03 PM   #1
CoderMan
Member
 
Registered: Jan 2009
Location: Gemini Capsule 25164
Distribution: Gentoo
Posts: 375
Blog Entries: 24

Rep: Reputation: 43
Question CPAN Test for LEGO::NXT: A Little Confused


I have some background in Perl, but I'm no guru. I'm just hoping to gain some clarity. So I wanted to install LEGO::NXT on a Fedora box through CPAN, and here is the story:

Code:
root@RoboLinux:~/.cpan/build/LEGO-NXT-2.00-1-zW4ntG$ cpan
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.9402)
Enter 'h' for help.

cpan[1]> install LEGO::NXT
CPAN: Storable loaded ok (v2.18)
Going to read '/root/.cpan/Metadata'
  Database was generated on Fri, 08 Jan 2010 19:42:03 GMT
CPAN: YAML loaded ok (v0.71)
Going to read 3 yaml files from /root/.cpan/build/
CPAN: Time::HiRes loaded ok (v1.9719)
DONE
Restored the state of none (in 0.1274 secs)
Running install for module 'LEGO::NXT'
Running make for C/CO/COLLINS/LEGO-NXT-2.00-1.tar.gz
  Has already been unwrapped into directory /root/.cpan/build/LEGO-NXT-2.00-1-zW4ntG
  Has already been made
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00_pod.t .... ok     
t/01_basic.t .. ok   
All tests successful.
Files=2, Tests=14,  1 wallclock secs ( 0.03 usr  0.00 sys +  0.16 cusr  0.01 csys =  0.20 CPU)
Result: PASS
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
No Bluetooth Address Specified!
make: *** [test_dynamic] Error 255
  COLLINS/LEGO-NXT-2.00-1.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports COLLINS/LEGO-NXT-2.00-1.tar.gz
Running make install
  make test had returned bad status, won't install without force
Failed during this command:
 COLLINS/LEGO-NXT-2.00-1.tar.gz               : make_test NO
I know very little about how CPAN building works, so I looked in .cpan and found a file called test.pl for the module I am trying to build:
Code:
root@RoboLinux:~/.cpan/build/LEGO-NXT-2.00-1-zW4ntG$ cat test.pl 
use LEGO::NXT;
use LEGO::NXT::BlueComm;
use LEGO::NXT::Constants qw(:DEFAULT);
use Data::Dumper;
use Net::Bluetooth;
use strict;

my $addr = $ARGV[0];
my $port = 1;

die "No Bluetooth Address Specified!\n" if !$addr;

$| = 1;

my $res;

my $bt = LEGO::NXT->new( new LEGO::NXT::BlueComm($addr,$port) );

$res = $bt->play_sound_file($NXT_RET, 0,'! Attention.rso');
print Dumper($res);

$res  = $bt->get_battery_level($NXT_RET);
print Dumper($res);

exit;

#Also try these!
#
#$res = $bt->play_tone($NXT_RET,220*2,500);
#$bt->set_output_state($NXT_NORET, $NXT_MOTOR_A, 100, $NXT_MOTORON|$NXT_REGULATED, $NXT_REGULATION_MODE_MOTOR_SPEED, 0, $NXT_MOTOR_RUN_STATE_RUNNING, 0  );
Evidently this is the test that failed because I can see the "No Bluetooth Address Specified!" error message in it. But looking at the test, I don't understand how it would ever succeed (being tried within CPAN) because you have to pass in a BlueTooth address as an argument to the script. Shouldn't the CPAN installer ask me for one, then? Or am I supposed to run some other command before trying to install the module so it knows to pass the argument?
 
Old 01-09-2010, 07:06 AM   #2
GooseYArd
Member
 
Registered: Jul 2009
Location: Reston, VA
Distribution: Slackware, Ubuntu, RHEL
Posts: 183

Rep: Reputation: 46
It looks like you're right- I don't think the author had anticipated that the test harness would get run without arguments.

The cpan shell will take a force flag for the install command (can't remember the syntax) that will install the module even if make test fails, that's your best bet.
 
Old 01-09-2010, 02:02 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
If you have all the dependencies installed ..

# cpan -fi LEGO::NXT

.. will install without doing the test(s).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware + Lego, anyone? niels.horn Slackware 33 06-13-2010 10:26 AM
Lego NXT Program Development Under Linux CoderMan Linux - Hardware 1 10-01-2009 05:44 PM
[SOLVED] [BASH] confused with test. RaptorX Programming 4 08-24-2009 03:21 PM
Confused about updating Fedora Core 2 Test 1 nutmeg Fedora 2 02-23-2004 02:12 AM
LEGO Mindstorms RIS 2.0 L.Tilley Linux - General 2 03-12-2002 12:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration