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

Jasan/normalize test #46

Merged
merged 5 commits into from
Dec 2, 2015
Merged

Jasan/normalize test #46

merged 5 commits into from
Dec 2, 2015

Conversation

jsarenik
Copy link
Collaborator

@jsarenik jsarenik commented Dec 2, 2015

Add test for normalize.sh.
Describe normalize.sh in README.
Use normalize.sh in runspftools.sh uber script :-)

@jsarenik
Copy link
Collaborator Author

jsarenik commented Dec 2, 2015

Interestingly enough, I can not reproduce the failure locally...

@jsarenik
Copy link
Collaborator Author

jsarenik commented Dec 2, 2015

Here's the debug output from CircleCI (given input ip4:207.68.169.172/30):

ubuntu@box355:~/spf-tools$ sh -x ./normalize.sh
+ read ip
ip4:207.68.169.172/30
+ echo ip4:207.68.169.172/30
+ cut -d: -f2
+ cidr=207.68.169.172/30
+ echo ip4:207.68.169.172/30
+ cut -d: -f1
+ ipver=ip4
+ [ ip4 = ip4 ]
+ echo ip4:207.68.169.172/30
+ cut -d: -f2 -
+ cidr=207.68.169.172/30
+ echo ip4:207.68.169.172/30
+ cut -s -d/ -f2
+ nm=30
+ [ x30 = x32 ]
+ [ x30 = x ]
+ network 207.68.169.172/30
+ local ip netmask
+ echo+ IFS=/ 207.68.169.172/30
 read ip netmask
+ ip2int 207.68.169.172
+ local a b c d
+ + IFS=. read a b c d
echo 207.68.169.172
+ echo 3477383596
+ IFS=. read a b c d
+ local addr=3477383596
+ local mask=17179869180
+ int2ip 3477383596
+ local ui32=3477383596
+ shift
+ local ip n
+ ip=172.207.68.169.172
+ ui32=13583529
+ ip=169.172.207.68.169.172
+ ui32=53060
+ ip=68.169.172.207.68.169.172
+ ui32=207
+ ip=207.68.169.172.207.68.169.172
+ ui32=0
+ echo 207.68.169.172.207.68.169.172
+ echo 207.68.169.172.207.68.169.172/30
+ IFS=/ read ip netmask
+ echo ip4:207.68.169.172.207.68.169.172/30
ip4:207.68.169.172.207.68.169.172/30

jsarenik pushed a commit that referenced this pull request Dec 2, 2015
@jsarenik jsarenik merged commit dabf469 into master Dec 2, 2015
@jsarenik
Copy link
Collaborator Author

jsarenik commented Dec 2, 2015

@jcbf Please have a look at the changes I made to ./normalize.sh and let me know if I misunderstood something.

The only way to make tests (with Dash shell) work was to get rid of using ip variable name in different functions. Otherwise, in case you didn't notice, I have removed the cidr=32 default which was in the code. I'm not sure how it could cause troubles with IPv6, but that was something which needed to be fixed so I fixed it. Everything works at the moment, just want you to know about the changes I did to the code you provided. Thanks!

@jsarenik jsarenik deleted the jasan/normalize_test branch December 2, 2015 19:55
@jcbf jcbf mentioned this pull request Apr 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant