# Ansible test-module corrupting executable before execution

**URL:** <https://forum.ansible.com/t/ansible-test-module-corrupting-executable-before-execution/15205>\
**Category:** Ansible Developer\
**Created:** [May 10, 2014, 8:35am UTC](https://forum.ansible.com/t/ansible-test-module-corrupting-executable-before-execution/15205 "2014-05-10T08:35:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roberto\_Aloi](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@Roberto\_Aloi](https://forum.ansible.com/u/Roberto_Aloi)\
**Post date:** [May 10, 2014, 8:35am UTC](https://forum.ansible.com/t/ansible-test-module-corrupting-executable-before-execution/15205/1 "2014-05-10T08:35:18Z")

</div>

I’m working on a new Ansible module and I would like to use the Ansible [test-module](https://github.com/ansible/ansible/blob/devel/hacking/test-module) script to verify it works, as explained [in the official ansible documentation](http://docs.ansible.com/developing_modules.html).

The executable is standalone and it works as expected on its own, but running the Ansible `test-module` on it fails.

I noticed that, before invoking my executable, the Ansible `test-module` does the following:

- It renames the executable into `.ansible_module_generated` (and it places it into my home dir)
- It appends a newline at the end of the executable

My executable is in a compressed format and the appended newline _corrupts_ its internal validation. Moreover, the executable requires the original executable name to be preserved, so the renaming is an issue, too.

Is the above behaviour specific to the `test-module` - which means that I can easily tweak the `test-module` script by stripping out the extra newline and by avoiding the renaming operation - or is it a general Ansible behaviour that the test-module is trying to emulate? Is there any workaround?

[You can also find this question on Stack Overflow at [http://stackoverflow.com/questions/23578846/ansible-test-module-corrupting-executable-before-execution](http://stackoverflow.com/questions/23578846/ansible-test-module-corrupting-executable-before-execution)]

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 13, 2014, 9:47pm UTC](https://forum.ansible.com/t/ansible-test-module-corrupting-executable-before-execution/15205/2 "2014-05-13T21:47:46Z")

</div>

Hi Roberto,

I believe I mentioned this on twitter previously, but in case you didn’t see it, support for binary modules isn’t in place just yet - [https://github.com/ansible/ansible/pull/6374](https://github.com/ansible/ansible/pull/6374) - we are currently attacking tickets in priority order and hope to get to this soon.

Basically that’s why test-module doesn’t work ATM with your module.

---

<div class="post-metadata">

**Author:** ![Roberto\_Aloi](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@Roberto\_Aloi](https://forum.ansible.com/u/Roberto_Aloi)\
**Post date:** [May 14, 2014, 5:37am UTC](https://forum.ansible.com/t/ansible-test-module-corrupting-executable-before-execution/15205/3 "2014-05-14T05:37:37Z")

</div>

Hi Michael,

This clarifies things. Thank you very much. Looking forward to binary modules, then.

KR,

Roberto
